ffmpeg处理视频命令
1. 剪切视频
ffmpeg -ss 00:00:00 -t 00:00:10 -accurate_seek -i multi.mp4 -codec copy multi10.mp4
PS C:\xilinx\Videos\4.6\ubuntu22.04> ffmpeg -ss 00:12:07 -to 00:14:25 -accurate_seek -i VID_20240406_163304.mp4 -codec copy ubuntuai2.mp4
2. 合并视频
ffmpeg -i ubuntuai0.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts ubuntuai0.ts
ffmpeg -i ubuntuai1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts ubuntuai1.ts
ffmpeg -i ubuntuai2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts ubuntuai2.ts
ffmpeg -i "concat: ubuntuai0.ts|ubuntuai1.ts|ubuntuai2.ts" -c copy -bsf:a aac_adtstoasc ubuntuai.mp4
REM 和 ::的区别:rem会被打印在屏幕上,::不会被打印在屏幕上
rem set a=1
::set b=2
3. mp4转h264
ffmpeg -i multi10.mp4 -c:v libx264 -pix_fmt nv12 -r 30 multi10.h264
4. mp4转yuv
ffmpeg -i p910.mp4 -s 1920x1080 -pix_fmt nv12 p909.yuv
5. yuv播放
ffplay -f rawvideo -video_size 144x144 out_decoder.yuv
6. mp4取一帧为背景
ffmpeg -i petalinux.mp4 -frames:v 1 -q:v 50 image.jpg
ffmpeg -loop 1 ss 00:00:00 to 00:01:15 -i image.jpg -i petalinux.mp4 -c:a copy petalinux_new.mp4