User Tools

Site Tools


ffmpeg

Useful Commands

dvd-slideshow -f slides.txt

dvdauthor -o DVD -x dvdauthor.xml

xine -u 0 dvd:"$(pwd)/DVD"

mkisofs -dvd-video -o dvd.iso DVD/
growisofs -dvd-compat -Z /dev/dvdrecorder=dvd.iso


mkisofs -r -R -J -o cd.iso dir/
cdrecord -v dev=ATA:0,1,0 cd.iso

ffmpeg -i ${VIDEO}.flv -sameq ${VIDEO}.mpg

ffmpeg -i ${VIDEO}.avi -pass 2 -target ntsc-dvd -aspect 4:3 ${VIDEO}.mpg

transcode -i HT.mpg -y ffmpeg -F mpeg2video -j 64,96 -E 44100 -b 128 -o HT2 -m
HT2.ac3

ffmpeg -i HT.mpg -croptop 64 -cropbottom 64 -cropleft 96 -cropright 96 -target
ntsc-dvd -aspect 4:3 HT2.mpg

ffmpeg -i ${VIDEO}.avi -vcodec wmv2 -ab 128 -b 200000 ${VIDEO}.wmv

ffmpeg -i ${VIDEO}.MOD -deinterlace -acodec libmp3lame -aspect 16:9 -b 9600k -ab 256k ${VIDEO}.mpg

ffmpeg -i ${VIDEO}.mpg -s 360x240 -ab 64k -acodec wmav2 ${VIDEO}.wmv

ffmpeg -i ${VIDEO}.mpg -s 480x320 -ab 64k -acodec wmav2 ${VIDEO}.wmv

ffmpeg -i ${VIDEO}.mpg -s 480x320 -acodec libmp3lame -ab 64k ${VIDEO2}.mpg

ffmpeg -i ${VIDEO}.mpg -target ntsc-dvd ${VIDEO}.vob

ffmpeg -i ${VIDEO}.MOD -sameq -f avi -vcodec mpeg4 -b 800k -g 300 -bf 2 -acodec libmp3lame -ab 128 ${VIDEO}.avi

Batch Convert

@echo off
set src=%1
 
for /r %%a in (%src%) do (ffmpeg -i "%%a" "%%~na.avi")

Concatenate two mp4 files

The videos need to have the same aspects to be joined without re-encoding (same size, bitrate, etc.)

ffmpeg -i first.mp4 -c copy -bsf h264_mp4toannexb first.ts
ffmpeg -i second.mp4 -c copy -bsf h264_mp4toannexb second.ts
ffmpeg -i "concat:first.ts|second.ts" -c copy -bsf aac_adtstoasc output.mp4

Decent Blu-Ray Compression

  • Determine the size of the black bars on top and bottom and crop them.
  • Play with the compression -crf value.
    • Ranges from 0 (lossless) to 51 (terrible)
    • 18-28 is usually pretty good. Default is 23.
    • The smaller the number the better quality but bigger output file.
  • Crop filter: -filter:v "crop=out_w:out_h:x:y"
    • out_w is the width of the output rectangle
    • out_h is the height of the output rectangle
    • x and y specify the top left corner of the output rectangle
    • Handbrake can be used as an easy way to get these values
ffmpeg -i input.mkv -filter:v "crop=1920:800:0:140" -c:v libx264 -preset medium -crf 23 -c:a aac -b:a 384k -strict -2 output.mp4
ffmpeg.txt · Last modified: 2016/05/14 11:04 (external edit)