学习ffmpeg
选项
-i # specify input file
-y # override output file with same name
-protocol_whitelist file,http,https,tcp,tls # access allowed protocols
-loglevel panic # log filter, panic/error/info
-stats # show stats data
-codec copy # keep origin codec
-vcodec copy # keep origin video codec
-vcodec libx264 # specify video codec
-acodec copy # keep origin audio codec
-acodec libfaac # specify audio codec
-max_muxing_queue_size 1024 # Fix error: `Too many packets buffered for output stream 0:1`
下载m3u8
ffmpeg -i http://www.xxx.com/xxx.m3u8 name.mp4
把 flv
转换为 mp4
ffmpeg -i input.flv -y -codec copy output.mp4
通用过滤器
- scale
- overlay
- crop
- trim
- rotate
修改比率(bitrate), 帧率(frame rate), 分辨率
ffmpeg -i input.mp4 -b 4000k -r 30 –s 1280*720 -y output.mp4
水印
ffmpeg -i input.mp4 -i logo.png -filter_complex overlay output.mp4 # top-left corner
ffmpeg -i input.mp4 -i logo.png -filter_complex overlay=W-w output.mp4 # top-right corner
# overlay=0:H-h # left bottom corner
# overlay=W-w:H-h # right bottom corner
延迟播放
# make video delayed
ffmpeg.exe -i "input.mp4" -itsoffset 1.5 -i "input.mp4" -map 1:v -map 0:a -c copy "make-video-delayed.mp4"
# make audio delayed
ffmpeg -i "input.mp4" -itsoffset 1.5 -i "input.mp4" -map 0:v -map 1:a -c copy "make-audio-delayed.mp4"