1.分離視頻音頻流
ffmpeg -i input_file -vcodec copy -an output_file_video //分離視頻流
ffmpeg -i input_file -acodec copy -vn output_file_audio //分離音頻流
2.視頻解復(fù)用
ffmpeg –i test.mp4 –vcodec copy –an –f m4v test.264
ffmpeg –i test.avi –vcodec copy –an –f m4v test.264
3.視頻轉(zhuǎn)碼
ffmpeg –i test.mp4 –vcodec h264 –s 352*278 –an –f m4v test.264//轉(zhuǎn)碼為碼流原始文件
ffmpeg –i test.mp4 –vcodec h264 –bf 0 –g 25 –s 352*278 –an –f m4v test.264//轉(zhuǎn)碼為碼流原始文件
ffmpeg –i test.avi -vcodec mpeg4 –vtag xvid –qsame test_xvid.avi//轉(zhuǎn)碼為封裝文件
//-bf B幀數(shù)目控制,-g 關(guān)鍵幀間隔控制,-s 分辨率控制
4.視頻封裝
ffmpeg –i video_file –i audio_file –vcodec copy –acodec copy output_file
5.視頻剪切
ffmpeg –i test.avi –r 1 –f image2 image-%3d.jpeg//提取圖片
ffmpeg -ss 0:1:30 -t 0:0:20 -i input.avi -vcodec copy -acodec copy output.avi//剪切視頻
//-r 提取圖像的頻率,-ss 開(kāi)始時(shí)間,-t 持續(xù)時(shí)間
6.視頻錄制
ffmpeg –i rtsp://192.168.3.205:5555/test –vcodec copy out.avi
7.YUV序列播放
ffplay -f rawvideo -video_size 1920x1080 input.yuv
8.YUV序列轉(zhuǎn)AVI
ffmpeg –s w*h –pix_fmt yuv420p –i input.yuv –vcodec mpeg4 output.avi