ffmpeg 常用命令

來源:互聯網
上載者:User

http://www.cnblogs.com/dwdxdy/p/3240167.html


1.分離視頻音頻流

ffmpeg -i input_file -vcodec copy -an output_file_video  //分離視頻流ffmpeg -i input_file -acodec copy -vn output_file_audio  //分離音頻流


2.視頻解複用

ffmpeg –i test.mp4 –vcodec copy –an –f m4v test.264ffmpeg –i test.avi –vcodec copy –an –f m4v test.264


3.視頻轉碼

ffmpeg –i test.mp4 –vcodec h264 –s 352*278 –an –f m4v test.264              //轉碼為碼流原始檔案ffmpeg –i test.mp4 –vcodec h264 –bf 0 –g 25 –s 352*278 –an –f m4v test.264  //轉碼為碼流原始檔案ffmpeg –i test.avi -vcodec mpeg4 –vtag xvid –qsame test_xvid.avi            //轉碼為封裝檔案//-bf B幀數目控制,-g 主要畫面格間隔控制,-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 開始時間,-t 期間


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序列轉AVI

ffmpeg –s w*h –pix_fmt yuv420p –i input.yuv –vcodec mpeg4 output.avi


常用參數說明:

主要參數:
-i 設定輸入資料流
-f 設定輸出格式
-ss 開始時間
視頻參數:
-b 設定視頻流量,預設為200Kbit/s
-r 設定畫面播放速率,預設為25
-s 設定畫面的寬與高
-aspect 設定畫面的比例
-vn 不處理視頻
-vcodec 設定視頻轉碼器,未設定時則使用與輸入資料流相同的轉碼器
音頻參數:
-ar 設定採樣率
-ac 設定聲音的Channel數
-acodec 設定聲音轉碼器,未設定時則使用與輸入資料流相同的轉碼器
-an 不處理音頻




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.