ffplay使用帮助说明

ffplay命令行使用指南


  • 简单的媒体播放器

  • 用法:ffplay [options] input_file

  • 查看官方帮助文档ffplay -h

    • Main options
    • Advanced options
    • AVOptions

播放多媒体文件

  1. 播放本地文件
    • ffplay test.flv
    • ffpaly -window_title "test window" test.flv # 指定播放窗口名称
  2. 播放网络流
    • ffplay rtmp://58.200.131.2:1935/livetv/cctv6
  3. 禁用音频或者视频
    • ffplay -an test.flv # 禁用音频
    • ffplay -vn test.flv # 禁用视频
  4. 指定解码器
    • ffplay -vcodec h264 test.flv # 指定h264解码器
  5. 播放YUV数据
    • ffplay -pixel_format yuv420p -video_size 1280x720 -framerate 5 1280x720_yuv420p.yuv
  6. 播放RGB数据
    • ffplay -pixel_format rgb24 -video_size 1280x720 -framerate 5 1280x720_rgb24.rgb
  7. 播放pcm数据
    • ffplay -ar 44100 -ac 2 -f s16le 44100_2_s16le.pcm

注:

  • window_title

    -window_title window title set window title

  • h264 mpeg4

    Codecs:
    D..... = Decoding supported
    .E.... = Encoding supported
    ..V... = Video codec
    ..A... = Audio codec
    ..S... = Subtitle codec
    ...I.. = Intra frame-only codec
    ....L. = Lossy compression
    .....S = Lossless compression

    DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m ) (encoders: libx264 libx264rgb h264_v4l2m2m h264_vaapi )
    DEV.L. mpeg4 MPEG-4 part 2 (decoders: mpeg4 mpeg4_v4l2m2m ) (encoders: mpeg4 mpeg4_v4l2m2m )

  • an vn

    -an disable audio
    -vn disable video

  • pixel_format | pix_fmt

    • ffplay 使用的参数为pixel_format,ffmpeg使用的参数是pix_fmt
    • -pixel_format <string> .D....... set video pixel format
  • s | video_size

    • ffplay使用的是video_size, ffmeg使用的参数是s
    • -s size set frame size (WxH or abbreviation)
  • framerate

    • -framerate <video_rate> .D....... set framerate (frames per second) (default "25")
  • ar ac

    • ar <int> ED..A.... set audio sampling rate (in Hz) (from 0 to INT_MAX) (default 0)
    • -ac <int> ED..A.... set number of audio channels (from 0 to INT_MAX) (default 0)
  • f

    • -f fmt force format

播放选项

主要选项 Main Options

选项 说明 原文
-x width 强制显示宽度 .D....... Initial x coordinate. (from 0 to INT_MAX) (default 0)
-y height 强制显示高度 .D....... Initial y coordinate. (from 0 to INT_MAX) (default 0)
-video_size size 帧尺寸 设置显示帧存储(WxH格式),仅适用于类似原始YUV等没有包含帧大小(WxH)的视频 .D....... A string describing frame size, such as 640x480 or hd720. (default "vga")
-pixel_format format 设置像素格式 .D....... set video pixel format
-fs 以全屏模式启动 force full screen
-an 禁用音频 disable audio
-vn 禁用视频 disable video
-sn 禁用字幕 diable subtitling
-ss pos 根据设置的位置进行定位播放 seek to a given position in seconds
-t duration 设置播放视频/音频时长 play "duration" seconds of audio/video
-bytes val 以字节为单位进行定位播放 seek by bytes 0=off 1=on -1=auto
-seek_interval interval 自定义左/右键定位拖动间隔 set seek interval for left/right keys, in seconds
-nodisp 关闭图形显示,不显示视频。。。 disable graphical display
-volume volume 设置起始音量 set startup volume 0=min 100=max
-f fmt 强制使用指定格式解码 force format
-window_title title 设置窗口标题(默认为文件名) set window title
-loop number 设置播放循环次数 set number of times the playback shall be looped
-showmode mode 设置显示模式,可用的模式值: 0 显示视频,1 显示音频波形,2 显示音频频谱。缺省为0,如果视频不存在则自动选择2 select show mode (0 = video, 1 = waves, 2 = RDFT)
-vf filter_graph 设置视频滤镜 set video filters
-af filter_graph 设置音频滤镜 set audio filters

高级选项 Advanced Options

参数 说明 原文
-stat 打印回放统计信息 show status
-fast 非标准规范的多媒体兼容优化 non spec compliant optimizations
-genpts 生成pts generate pts
-sync type 同步类型,默认audio为主时钟 set audio-video sync. type (type=audio/video/ext)
-ast audio_stream_specifier 指定音频流索引 select desired audio stream
-vst video_stream_specifier 指定视频流索引 select desired video stream
-sst substitle_stream_specifier 指定字幕流索引 select desired substitle stream
-autoexit 视频播放完成后自动退出 exit at the end
-exitonkeydown 键盘按下任何键退出播放 exit on key down
-exitonmousedown 鼠标按下任何键退出播放 exit on mouse down
-codec:media_specifier codec_name 强制使用设置的多媒体解码器, media_specifier可选值为a(audio), v(video), s(substitle),如codec:v h264 , 同名表示:-vcodec h264 == -c:v h264 == -codec:v h264
-acodec codec_name 强制使用设置的音频解码器进行音频解码 force audio decoder
-vcodec codec_name 强制使用设置的视频解码器进行视频解码 force video decoder
-scodec codec_name 强制使用设置的字幕解码器进行字幕解码 force subtitle decoder
-autorotate 根据文件元数据进行自动旋转 automatically rotate video
-framedrop 如果视频不同步则丢弃视频帧。当主时钟非视频时钟时默认开启。若需禁用则使用 -noframedrop drop frames when cpu is too slow
-infbuf 不限制输入缓冲区大小。此选项将不限制缓冲区的大小。若需禁用则使用-noinfbuf don't limit the input buffer size (useful with realtime streams)

播放控制

快捷键 作用 原文
q, ESC 退出 Quit.
f 全屏切换 Toggle full screen.
p, space 暂停/播放切换 Pause.
m(mute) 静音切换 Toggle mute.
9, 0 9减小音量,0增大音量 Decrease and increase volume respectively.
/, * /减小音量,*增大音量 Decrease and increase volume respectively.
a 循环切换音频流 Cycle audio channel in the current program.
v 循环切换视频流 Cycle video channel.
t 循环切换字幕流 Cycle subtitle channel in the current program.
s 逐帧播放 Step to the next frame.
Pause if the stream is not already paused, step to the next video frame, and pause.Cycle program.
c 循环切换节目 Cycle program.
w 循环切换过滤器或显示模式 Cycle video filters or show modes.
left/right 向后/向前拖动10s Seek backward/forward 10 seconds.
down/up 向后/向前拖动1min Seek backward/forward 1 minute.
鼠标右键单击 拖动与显示宽度对应百分比的文件进行播放 Seek to percentage in file corresponding to fraction of width.
鼠标左键双击 全屏切换 Toggle full screen.
page down/up 查找前一章/下一章。或者如果没有章节,请向后/向前寻求 10 分钟。 Seek to the previous/next chapter. or if there are no chapters Seek backward/forward 10 minutes.

简单过滤器

  • 视频旋转

    ffplay -i test.flv -vf transpose =1 # 顺时针旋转90度

  • 视频反转

    ffplay -i test.flv -vf hflip # 以垂直中线互换左右

    ffplay -i test.flv -vf vflip # 以水平中线互换上下

  • 视频旋转同时反转

    ffplay -i test.flv -vf hflip,transpose=2 # 多个滤镜,相同参数,逗号间隔

  • 音频倍数播放

    ffplay -i test.flv -af atempo=3

  • 视频倍数播放

    ffplay -i test.flv -vf setpts=PTS/3

  • 音频与视频同时倍数

    ffplay -i test.flv -vf setpts=PTS/3 -af atempo=3 # 多个滤镜,不同种类参数,空格追加

参考文档http://www.ffmpeg.org/ffplay.html

本文来自博客园,作者:flxx,转载请注明原文链接:https://www.cnblogs.com/faithlocus/p/15518520.html

原文地址:https://www.cnblogs.com/faithlocus/p/15518520.html