FFMPEG via commandline

Emanuel Züger
2018-05-01 10:38

To encode raw content (picture sequences, uncompressed video streams, etc.) you can use the free video encoder FFMPEG (learn more here: http://ffmpeg.org/). It just has a commandline interface, which is - after a bit of learning - surprisingly efficient to use.

Running FFMPEG from the commandline:

path_to_ffmpeg_exe\ffmpeg.exe

General usage:

ffmpeg -h               // display help
ffmpeg -formats | more  // display supported video formats (paginated)
ffmpeg -codecs | more   // display supported video codecs (paginated)

Encoding Commands

-pix_fmt rgb24                     //for RGB formats
-pix_fmt yuv420p                   //for YUV formats
-pix_fmt bgr24                     //for BGR formats

-compression_algo raw              //for uncompressed


-vf      "scale=4096:2160"         //scaling the resolution
         "crop=3840:2160:0:0"     //to cut the sice

-framerate 60                      //for fps (frames per second)

-vcodec libx264                    //for H264 Codec
-vcodec libx265                    //for H265 Codec
-vcodec prores_ks                  //for Prores
-vcodec hap -format hap            //for HAP
-vcodec hap -format hap_q          //for HAPQ

-chunks 4                          //for hap: encoding can use 0-4 threads

-vcodec prores -profile:v 2        //Prores Profiles: 
                                   //0: ProRes422 (Proxy) – apco
                                   //1: ProRes422 (LT) – apcs
                                   //2: ProRes422 (Normal) – apcn
                                   //3: ProRes422 (HQ)- apch
                                   
-qscale:v 10                       //quality for prores 0-32 (9-13 good)
-crf 24                            //value for the biterate when using H265 or H264 
                                   //CRF (Constant Rate Factory 0-51) 
                                   //small value --> high bitrate (22-26 is default) 
-preset veryslow                   //slow presets => better compression 
                                   //(veryslow,slow,fast,veryfast)

%05d.tif                           //for picture sequences (decimal placeholder)
                                   //(image_00001.tif = image_%05d.tif)   

endings:

H265	= .mp4
H264	= .mp4
HAP 	= .mov
HAPQ	= .mov

Examples

TIFF --> DPX + scaling
ffmpeg -i "V:\Frames_8kx4k\Testvideo_8192x4302_%04d.tif" -pix_fmt rgb24 -vf "scale=4096:2160" "V:\DPX 4096x2160 8Bit 60fps\RAW_DEMO_4k_8Bit_%04d.dpx"

TIFF --> H264 420
ffmpeg  -r 60 -i "V:\TIFF 4096x2160 16Bit 30fps\Testvideo_%05d.tif" -vcodec libx264 -r 60 -crf 26 -pix_fmt yuv420p "V:\H264 4096x2160 8Bit 60fps\Testvideo_4k_30fps.mp4"

PNG --> HAP
ffmpeg -r 60 -i "V:\4k_png\Testvideo_000%05d.png" -vcodec hap -format hap -chunks 8 -r 60 "V:\HAP 4096x2160 8Bit 60fps\Testvideo_4K_hap.mov"

TIFF --> Prores 444
ffmpeg -r 60 -i "V:\TIFF 4096x2160 8Bit 60fps\Testvideo_%05d.tif" -vcodec prores -c:v prores_ks -profile:v 3  -qscale:v 15 -pix_fmt yuv444p10le -vf "scale=1920:1080" -r 60 "V:\Testvideo_FHD_prores_444_HQ(3)_q15.mov"

TIFF --> TGA
ffmpeg -framerate 60 -i "V:\TIFF 4096x2160 8Bit 60fps\Testvideo_4K_8Bit_%05d.tif" -coder "raw" -pix_fmt bgr24 -vf "scale=1920:1080" "V:\Testvideo_FHD_8Bit_%05d.tga"


Split a 7680x2160 DPX sequnece into two 3840x2160 parts:
 
CROP left Part:
ffmpeg -i "V:\Testvideo_%05d.dpx" -filter:v "crop=3840:2160:0:0" "V:\Testvideo_crop_left_%05d.dpx"
 
CROP right Part:
ffmpeg -i "V:\Testvideo_%05d.dpx" -filter:v "crop=3840:2160:3840:0" "V:\Testvideo_crop_right_%05d.dpx"


Split a 7680x2160 DPX sequnece into two 3840x2160 parts:
CROP left Part:
ffmpeg -i "V:\Content\120fps Test\Komp 1_%05d.dpx" -filter:v "crop=3840:2160:0:0" "V:\Content\120fps Test\crop\Komp_1_crop_left_%05d.dpx"
 
CROP right Part:
ffmpeg -i "V:\Content\120fps Test\Komp 1_%05d.dpx" -filter:v "crop=3840:2160:3840:0" "V:\Content\120fps Test\crop\Komp_1_crop_right_%05d.dpx"

Examples Fulldome

PNG --> HAP Domemaster 4K@30Hz (1 file)
ffmpeg -r 30 -i "V:\FRAMES_4K\Dome_30fps_%05d.png" -vcodec hap -format hap -r 30 "V:\ENC_4K\Dome_4K_30fps.mov"

PNG --> HAP_Q Domemaster 4K@30Hz (1 file)
ffmpeg -r 30 -i "V:\FRAMES_4K\Dome_30fps_%05d.png" -vcodec hap -format hap_q -r 30 "V:\ENC_4K\Dome_4K_30fps-HAP_Q.mov"


PNG --> HAP Domemaster 6K@60Hz (2 files: top and bottom)

Top part
ffmpeg -r 60 -i "V:\FRAMES_6K\Dome_60fps_%05d.png" -filter:v "crop=6000:3000:0:0" -vcodec hap -format hap -r 60 "V:\ENC_4K\Dome_6K_60fps_TOP.mov"

Bottom part
ffmpeg -r 60 -i "V:\FRAMES_6K\Dome_60fps_%05d.png" -filter:v "crop=6000:3000:0:3000" -vcodec hap -format hap -r 60 "V:\ENC_4K\Dome_6K_60fps_BOT.mov"
Average rating: 0 (0 Votes)

You cannot comment on this entry