ffmpeg -ss <start_time_hh:ii:ss> -i input.mp4 -to <length_in_hh:ii:ss_from_start> -c copy ./out.mp4
ffmpeg -ss 00:47:42 -i input.mp4 -to 00:01:49 -c copy ./out.mp4
ffmpeg -i input.mp4 -r 30/1 ./out-%03d.jpg
ffmpeg -f concat -i filelist.txt -c:v copy ./out.mp4
Contents if filelist.txt
:
file input1.mp4
file input2.mp4
Note: Must call ffmpeg
in path of filelist.txt
and use relative paths in filelist.txt
!
Blur video:
ffmpeg -i input.mp4 -vf "boxblur=5:1" ./out.mp4
Add blur overlay to specific area:
ffmpeg -i input.mp4 -filter_complex "[0:v]crop=<width_px>:<height_px>:<margin_left_px>:<margin_top_px>,boxblur=<chroma_level_1-9>[fg]; [0:v][fg]overlay=<margin_left_px>:<margin_top_px>[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart ./out.mp4
ffmpeg -i input.mp4 -filter_complex "[0:v]crop=120:40:60:40,boxblur=9[fg]; [0:v][fg]overlay=60:40[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy -movflags +faststart ./out.mp4
More examples (e.g. how to use masks)
ffmpeg -i rtmp://web1.iptv-planet.com:81/live2/ -y -f flv ./out.flv
ffmpeg -i "http://example.com/playlist.m3u8" -c:v copy -bsf:a aac_adtstoasc ./out.mp4
If you have libfaac:
# mpeg4 (native) -> mpeg4 (native)
ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a libfaac -b:a 192k -ac 2 out.mp4
ffmpeg -i input.avi -c:v libx264 -crf 19 -preset slow -c:a aac -strict experimental -b:a 192k -ac 2 out.mp4
If you don't have libfaac:
# mpeg4 (native) -> mpeg4 (native)
# mp3 (native) -> aac (native)
ffmpeg -i input.avi -acodec libfaac -b:a 192k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 ./out.mp4
ffmpeg -i input.avi -acodec aac -strict experimental -b:a 192k -vcodec mpeg4 -b:v 1200k -flags +aic+mv4 ./out.mp4
# mpeg4 (native) -> h264 (libx264)
ffmpeg -i input.avi -c:v libx264 -crf 22 -preset medium -c:a aac -strict experimental -b:a 192k -ac 2 ./out.mp4
# mpeg4 (native) -> h264 (libx264)
# mp3 (native) -> aac (native)
ffmpeg -i input.avi -c:v libx264 -crf 23 -profile:v high -r 30 -c:a aac -strict experimental -q:a 100 -ar 48000 out.mp4
# alternatives: -b:a 128k
# -b:a 192k
# -crf 19 -preset slow
# -crf 22 -preset medium
ffmpeg -i input.flv -vcodec copy -acodec copy ./out.mp4
ffmpeg -i input.flv -c:v copy -bsf:a aac_adtstoasc ./out.mp4
If the error Could not find tag for codec vp6f in stream #0, codec not currently supported in container
occurs, try:
ffmpeg -i input.flv -c:v libx264 -crf 23 -preset medium -c:a aac -strict -2 -b:a 128k -ar 44100 -ac 2 ./out.mp4
ffmpeg -i file.wmv -vcodec libx264 -pix_fmt yuv420p -profile:v baseline -preset medium -crf 22 -movflags +faststart ./out.mp4
ffmpeg -i input.wmv -c:v libx264 -crf 23 -preset medium ./out.mp4
ffmpeg -i input.wmv -c:v libx264 -crf 23 -c:a libfaac -q:a 100 ./out.mp4
ffmpeg -i input.wmv -c:v libx264 -crf 23 -profile:v high -r 30 -c:a libfaac -q:a 100 -ar 48000 ./out.mp4
ffmpeg -i input.wmv -c:v libx264 -crf 23 -profile:v high -r 30 -c:a aac -strict experimental -q:a 100 -ar 48000 ./out.mp4
FAAC is an MPEG-4 and MPEG-2 AAC encoder.
-flag
The flag command is used to by calling "-flag", followed by a single space and then all flags with a plus "+" or minus "-" sign preceding each indicating active or inactive flag respectively.+aic
h263 advanced intra coding / mpeg4 ac prediction (Affects: Encoding, Video)+mv4
Use four motion vector by macroblock (mpeg4) (Affects: Encoding, Video)-bsf:a aac_adtstoasc
Convert MPEG-2/4 AAC ADTS to an MPEG-4 Audio Specific Configuration bitstream. Is required for example when copying an AAC stream from a raw ADTS AAC or an MPEG-TS container to MP4A-LATM, to an FLV file, or to MOV/MP4 files and related formats such as 3GP or M4A.