Export high-quality animations with ffmpeg

In television type TDA (terrestrial digital television) the MXF standard is used at 50MB per second, this standard is not universal, but it is one of the most widely used and free formats.

This is an example of its use, I encode the images in uncompressed PNG next to the uncompressed 24-bit audio. If “breakers” continue to appear with this configuration, it is best to modify the “qmax”. The “threads” refers to the processor cores, in my case there are 8, this may be different on each computer.

ffmpeg -threads 8 -i %05d.png -i audio.wav -pix_fmt yuv422p -vcodec mpeg2video -non_linear_quant 1 -flags +ildct+ilme -top 1 -dc 10 -intra_vlc 1 -qmax 6 -lmin "1*QP2LAMBDA" -vtag xd5c -rc_max_vbv_use 1 -rc_min_vbv_use 1 -g 12 -b:v 50000k -minrate 50000k -maxrate 50000k -bufsize 8000k -acodec pcm_s24le -ar 48000 -bf 2 -ac 2 out.mxf

After creating the quality file, create the web versions:

ffmpeg -y -vsync 0 -threads 8 -hwaccel vdpau -i 4232.mxf $QUALITY -vcodec libvpx -acodec libvorbis -b:a 160K -f webm 4232.webm

In $ QUALITY you can put:

-s 256x144 -b:v 95K
-s 426x240 -b:v 220K
-s 640x360 -b:v 405K
-s 854x480 -b:v 752K
-s 1280x720 -b:v 1505K
-s 1920x1080 -b:v 2646K

So far this format has been very practical for me because it works both in mobile browsers and desktop computers.

Posted in Tutorials and tagged , .