losslessly concat mp4 files

ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
ffmpeg -i «concat:intermediate1.ts|intermediate2.ts» -c copy -bsf:a aac_adtstoasc output.mp4

concat files with the same format

  1. create a file list
    file ‘/path/to/file1’
    file ‘/path/to/file2’
    file ‘/path/to/file3’
  2. concat
    ffmpeg -f concat -i mylist.txt -c copy output

encode Xvid

ffmpeg -i input.avi -c:v mpeg4 -vtag xvid -b:v 600k -c:a libmp3lame output.avi

encode h264

ffmpeg -i input.avi -c:v libx264 -preset ultrafast -crf 22 -c:a copy output.mp4

change resolution + cut 20 seconds(0:00-0:20)

ffmpeg -i input.avi -ss 0 -t 20 -c:v libx264 -s 640×360 -c:a copy output.mp4

ПОЛЕЗНО  Как отключить обновление до Windows 10

encode mp4 file for ipad use

ffmpeg -i input.mp4 -c:v libx264 -preset medium -b:v 1200k -s 640×360 -c:a libvo_aacenc -b:a 64k output.mp4

add watermark

# top left corner
ffmpeg –i inputvideo.avi -vf «movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:10 [out]» outputvideo.flv

# Top right corner
ffmpeg –i inputvideo.avi -vf «movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w-overlay_w-10:10 [out]» outputvideo.flv

# Bottom left corner
ffmpeg –i inputvideo.avi -vf «movie=watermarklogo.png [watermark]; [in][watermark] overlay=10:main_h-overlay_h-10 [out]» outputvideo.flv

# Bottom right corner
ffmpeg –i inputvideo.avi -vf «movie=watermarklogo.png [watermark]; [in][watermark] overlay=(main_w-overlay_w-10)/2:(main_h-overlay_h-10)/2 [out]» outputvideo.flv

# center
ffmpeg -i inputvideo.avi -vf «movie=watermarklogo.png [watermark]; [in][watermark] overlay=main_w/2-overlay_w/2:main_h/2-overlay_h/2 [out]» outputvideo.flv