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 640x360 -c:a copy output.mp4

encode mp4 file for ipad use

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

ПОЛЕЗНО  К сожалению не удалось подключиться к Skype

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

Быстро разбить видео на несколько частей (разбивка по точно заданным временным промежуткам)

ffmpeg -i largefile.mp4 -t 00:50:00 -c copy smallfile1.mp4 -ss 00:50:00 -c copy smallfile2.mp4

How to add my logo for the first 30 seconds in a video with ffmpeg?

ffmpeg -i in.mp4 -framerate 30000/1001 -loop 1 -i logo.png -filter_complex
  "[1:v] fade=out:st=30:d=1:alpha=1 [ov]; [0:v][ov] overlay=10:10 [v]" -map "[v]"
  -map 0:a -c:v libx264 -c:a copy -shortest out.mp4

This assumes that the logo is a single still image with an alpha channel and you want to overlay it over a video with a frame rate of 30000/1001 (NTSC rate). Change the -framerate to match your input video if it is different. If your logo is a video then omit -framerate 30000/1001 -loop 1. If the logo does not have an alpha channel, add one by inserting e.g. format=yuva420p, immediately before fade.

ПОЛЕЗНО  Удаляем китайский kingsoft internet security

This will display the logo at x,y position 10,10 for 30 seconds followed by a 1 second fade out.