Coffee Space


Video Compression

Preview Image

I still use an ultra-old, ultra-cheap Amazon Kindle device for watching videos in bed. Once I side-loaded it with the Google app-store, I have been able to add Youtube, VLC and Firefox - greatly increasing its usefulness.


One thing really old Android devices (and devices in general) need is their video content encoded as H264 to allow for hardware acceleration, as their CPUs are not fast enough to handle this in software at real-time.

I each this with the following:

0001 $ffmpegnvidia                                               \
0002   -threads 8 -hwaccel cuvid                                 \
0003   -i "$f"                                                   \
0004   -map 0:v:0 -c:v h264_nvenc                                \
0005   -profile:v baseline                                       \
0006   -pix_fmt yuv420p                                          \
0007   -preset slow                                              \
0008   -b:v 500k                                                 \
0009   -maxrate 500k                                             \
0010   -bufsize 1000k                                            \
0011   -vf scale=-2:480                                          \
0012   -map 0:a:0 -c:a aac                                       \
0013   -b:a 128k                                                 \
0014   -map 0:s:0 -c:s mov_text                                  \
0015   "$f.mp4"

Note the following:

Hopefully that helps somebody out there!