日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

FFmpeg中可执行文件ffmpeg用法汇总

發布時間:2023/11/27 生活经验 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 FFmpeg中可执行文件ffmpeg用法汇总 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

從https://ffbinaries.com/downloads 下載最新的4.1版本的Windows 64位FFmpeg,FFmpeg是一個快速的音頻/視頻轉換工具,FFmpeg可以作為一個命令行程序單獨使用。

通過執行以下命令將FFmpeg信息重定位到ffmpeg_help.txt文件中便于查看,其內容如下,FFmpeg使用方法為:ffmpeg.exe [options] [[infile options] -i infile]... {[outfile options] outfile}...

ffmpeg.exe --help > ffmpeg_help.txt
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...Getting help:-h      -- print basic options-h long -- print more options-h full -- print all options (including all format and codec specific options, very long)-h type=name -- print all options for the named decoder/encoder/demuxer/muxer/filter/bsfSee man ffmpeg for detailed description of the options.Print help / information / capabilities:
-L                  show license
-h topic            show help
-? topic            show help
-help topic         show help
--help topic        show help
-version            show version
-buildconf          show build configuration
-formats            show available formats
-muxers             show available muxers
-demuxers           show available demuxers
-devices            show available devices
-codecs             show available codecs
-decoders           show available decoders
-encoders           show available encoders
-bsfs               show available bit stream filters
-protocols          show available protocols
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats
-colors             show available color names
-sources device     list sources of the input device
-sinks device       list sinks of the output device
-hwaccels           show available HW acceleration methodsGlobal options (affect whole program instead of just one file:
-loglevel loglevel  set logging level
-v loglevel         set logging level
-report             generate a report
-max_alloc bytes    set maximum size of a single allocated block
-y                  overwrite output files
-n                  never overwrite output files
-ignore_unknown     Ignore unknown stream types
-filter_threads     number of non-complex filter threads
-filter_complex_threads  number of threads for -filter_complex
-stats              print progress report during encoding
-max_error_rate maximum error rate  ratio of errors (0.0: no errors, 1.0: 100% errors) above which ffmpeg returns an error instead of success.
-bits_per_raw_sample number  set the number of bits per raw sample
-vol volume         change audio volume (256=normal)Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-to time_stop       record or transcode stop time
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-sseof time_off     set the start time offset relative to EOF
-seek_timestamp     enable/disable seeking by timestamp with -ss
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-program title=string:st=number...  add program with specified streams
-target type        specify target file type ("vcd", "svcd", "dvd", "dv" or "dv50" with optional prefixes "pal-", "ntsc-" or "film-")
-apad               audio pad
-frames number      set the number of frames to output
-filter filter_graph  set stream filtergraph
-filter_script filename  read stream filtergraph description from a file
-reinit_filter      reinit filtergraph on input parameter changes
-discard            discard
-disposition        dispositionVideo options:
-vframes number     set the number of video frames to output
-r rate             set frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-bits_per_raw_sample number  set the number of bits per raw sample
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter_graph    set video filters
-ab bitrate         audio bitrate (please use -b:a)
-b bitrate          video bitrate (please use -b:v)
-dn                 disable dataAudio options:
-aframes number     set the number of audio frames to output
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-vol volume         change audio volume (256=normal)
-af filter_graph    set audio filtersSubtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-canvas_size size   set canvas size (WxH or abbreviation)
-spre preset        set the subtitle options to the indicated preset

以下匯總FFmpeg的常用操作:

1. 在Windows上查看已連接的捕獲設備(capture devices)如攝像頭,執行以下命令,如果安裝了DirectShow也可以將vfwcap替換為dshow:

ffmpeg.exe -y -f vfwcap -i list
ffmpeg.exe -list_devices true -f dshow -i dummy

在Windows上將從capture device上獲取的視頻流數據保存成mp4文件,執行:

ffmpeg.exe -y -f vfwcap -r 25 -i 0 out.mp4

2. 在Linux上,當插上usb攝像頭(/dev/video0)時,查看可用設備的可用格式(包括支持的像素格式、視頻格式、幀大小),執行:

./ffmpeg -f v4l2 -list_formats all -i /dev/video0

在Linux上將從/dev/video0上獲取的視頻流數據保存成mkv文件,執行:

./ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -input_format mjpeg -i /dev/video0 output.mkv

3. 在不同的媒體文件之間轉換,如將1.mkv轉換為1.mp4并設置其大小為1920x1080,執行:

ffmpeg.exe -i 1.mkv -s 1920x1080 1.mp4

4. 從視頻文件中提取圖像,如從視頻文件tree.avi中提取圖像并保存成png,圖像名為image-001.png, image-002.png等,執行:

ffmpeg.exe -i tree.avi -r 1 -f image2 image-%3d.png

5. 壓縮視頻文件,如減少視頻比特率(video bit rate),執行:

ffmpeg.exe -i tree.avi -b:v 100k tree2.avi

6. 剪切視頻文件,如開始剪切的時間點為10秒處(00:00:10),剪切時間長度為5秒,則執行:

ffmpeg.exe -i tree.avi -ss 00:00:10 -t 5 tree.mp4

7. 將rtsp視頻流保存成視頻文件,執行:

ffmpeg.exe -i rtsp://184.72.239.149/vod/mp4://BigBuckBunny_115k.mov -vcodec copy out.mp4

8.?在windows上獲取視頻設備名,執行:

ffmpeg.exe -list_devices true -f dshow -i dummy

9.?在windows上獲取指定視頻設備支持的編解碼格式及視頻size,執行:

ffmpeg.exe -f dshow -list_options true -i video="Integrated Webcam"

10. 在windows上通過dshow生成mjpeg數據,執行:

ffmpeg.exe -f dshow -vcodec mjpeg -s 640x480 -framerate 30 -i video="Integrated Webcam" outfile.mpg

GitHub:https://github.com/fengbingchun/OpenCV_Test

總結

以上是生活随笔為你收集整理的FFmpeg中可执行文件ffmpeg用法汇总的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。