$ ffmpeg -i source.mp4 -vf fps=fps=15,scale=480:-1 -b:v 450k -b:a 50k out.mp4
Convert mp4 into gif and scale it with maintaining aspect ratio.
$ ffmpeg -i in.mp4 -vf scale=1024:-1 out.gif
Convert mp4 into gif, set fps, and scale it to half size with maintaining aspect ratio.
$ ffmpeg -i in.mp4 -vf fps=fps=30,scale=w=iw/2:-1 out.gif
Convert mp4 into fMP4 hls.
ffmpeg -i ~/20200526_200518.mp4 -f hls -hls_segment_type fmp4 -hls_playlist_type vod -c:v copy stream.m3u8
Crop a video temporally and spatially (width=1300, height=1200, x=1700, y=3000, from 00:10 to 00:22).
$ ffmpeg -i in.mp4 -vf "crop=1300:1200:1700:300" -ss 00:10 -t 00:12 out.mp4
$ ffmpeg -i input.mp4 -filter_complex drawtext="fontfile=/System/Library/Fonts/Helvetica.ttc:fontsize=160:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text='LGTM'" -t 00:00:03 output.gif
$ ffmpeg -i in.mp4 -vf setpts=PTS/2.0 -af atempo=2.0 out.mp4
Extract .wav file from .mp4 in 44.1kHz stereo.
$ ffmpeg -i in.mp4 -t 00:10:00 -ac 2 -ar 44100 out.wav
from 00:01:00, duration 10s
length of ts file is 0.666s
ffmpeg -i in.mp4 -g 10 -hls_time 0.666 -ss 00:01:00 -t 00:00:10 out.m3u8
$ ffmpeg -framerate 5 -i 'one-image.png' -pix_fmt yuv420p movie.mp4
$ ffmpeg -framerate 5 -pattern_type glob -i 'image*.png' -pix_fmt yuv420p movie.mp4
$ ffmpeg -i in.mp4 -an out.mp4
ffmpeg -i recorded.wav -i bgm.mp3 -filter_complex amerge -ac 2 -c:a libmp3lame -q:a 4 output.mp3
Publish rtmp stream from mp4 file
ffmpeg -y -stream_loop -1 -re -i ~/20200526_200518.mp4 -f flv rtmp://192.168.11.7:1935/app/stream