zoukankan      html  css  js  c++  java
  • FFmpeg 常用参数使用

    ffmpeg http://ffmpeg.org

    Video 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 data

    Audio 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 filters

    1. -i url (input) input file url
    转换文件 ffmpeg -i input.mp4 output.avi
    提取音频 ffmpeg -i input.mp4 output.mp3
    网络转存 ffmpeg -i rtmp://|http:// -c copy output.mp4

    2. 编码参数 -c / -codec
    -c[:stream_specifier] codec (input/output,per-stream)
    -codec[:stream_specifier] codec (input/output,per-stream)
    ffmpeg -i input.mp4 -c:v libx264 -c:a copy output.mp4
    ffmpeg -i input.mp4 -vcodec h264 output.mp4
    ffmpeg -i input.mp4 -vcodec mpeg4 output.mp4

    3. 提示错误 Protocol 'tcp' not on whitelist 'file,http'!
    ffmpeg -protocol_whitelist "file,http,https,tcp,tls" -i input.m3u8 -codec copy output.ts

    4. 禁用音频/视频 -an/-vn 
    ffmpeg -i input.mp4 -vcodec copy -an output.mp4
    ffmpeg -i input.mp4 -acodec copy -vn output.mp3

    5. 裁剪视频 -ss position (input/output) 开始时间  -t duration (input/output) 时长
    ffmpeg -ss 00:01:00 -t 00:01:05 -i input.mp4 -c copy output.mp4 

    6. 视频分辨率 -s[:stream_specifier] size (input/output,per-stream)
    ffmpeg -i input.mp4 -s 1280*720 output.mp4
    ffmpeg -i input.mp4 -s 1280x720 output.mp4

    7. 视频宽高比 -aspect[:stream_specifier] aspect (output,per-stream)
    ffmpeg -i input.mp4 -aspect 1.3333 output.mp4

    8. 视频合并 - 新建文件 list.txt 内容如下:
    file '1.mp4'
    file '2.mp4'
    file '3.mp4'
    ffmpeg -f concat -i list.txt -c copy output.mp4

    9. 录制屏幕 Windows下屏幕录制的设备:gdigrab,gdigrab是基于GDI的抓屏设备。
    通过设定支持两种方式抓取:
    (1)“desktop”:抓取桌面或者桌面的特定区域。
    (2)“title={窗口名称}”:抓取特定窗口。
    ffmpeg -f gdigrab -i desktop -f mp4 output.mp4
    ffmpeg -f gdigrab -offset_x 0 -offset_y 0 -s 480*320 -i desktop -f mp4 output.mp4
    ffmpeg -f gdigrab -i title="Cmder" -f mp4 output.mp4

    10. 摄像头录制
    ffmpeg -list_devices true -f dshow -i dummy 枚举采集设备
    ffmpeg -list_options true -f dshow -i video="USB Camera" 获取指定视频采集设备支持的分辨率、帧率和像素格式等
    ffmpeg -f dshow -i video="USB Camera" -f dshow -i audio="USB Audio Device)" -vcodec libx264 -acodec aac Camera.mkv
    ffmpeg -y -i rtsp://cameral_ip:port -c copy Camera.mp4
    ffplay -f dshow -i video="USB Camera"
    ffplay -f dshow -s 640x480 -i video="USB Camera"

    ————————————————
    版权声明:本文为CSDN博主「凌酱」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
    原文链接:https://blog.csdn.net/ivasox/article/details/103106320

  • 相关阅读:
    hdu 1593 find a way to escape
    bzoj4561: [JLoi2016]圆的异或并
    hdu 3511 Prison Break
    hdu 5299 Circles Game
    ORA-15025: could not open disk "/dev/asm***"--转载
    修改目的端trail文件的最大大小--转载
    MYSQL PERFORMANCE_SCHEMA HINTS
    Oracle 收缩表大小 Oracle Shrink Table --转载
    InnoDB: Error number 24 means ‘Too many open files’.--转载
    使用asmcmdcp命令把datafile从文件系统移动(move)到asm磁盘组中 针对11gR2
  • 原文地址:https://www.cnblogs.com/javalinux/p/14591008.html
Copyright © 2011-2022 走看看