ffplay命令行使用指南
-
簡單的媒體播放器
-
用法:ffplay [options] input_file
-
查看官方幫助文檔
ffplay -h
- Main options
- Advanced options
- AVOptions
播放多媒體文件
- 播放本地文件
ffplay test.flv
ffpaly -window_title "test window" test.flv
# 指定播放窗口名稱
- 播放網絡流
ffplay rtmp://58.200.131.2:1935/livetv/cctv6
- 禁用音頻或者視頻
ffplay -an test.flv
# 禁用音頻ffplay -vn test.flv
# 禁用視頻
- 指定解碼器
ffplay -vcodec h264 test.flv
# 指定h264解碼器
- 播放YUV數據
ffplay -pixel_format yuv420p -video_size 1280x720 -framerate 5 1280x720_yuv420p.yuv
- 播放RGB數據
ffplay -pixel_format rgb24 -video_size 1280x720 -framerate 5 1280x720_rgb24.rgb
- 播放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 compressionDEV.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 | 強制顯示寬度 |
|
-y height | 強制顯示高度 |
|
-video_size size | 幀尺寸 設置顯示幀存儲(WxH格式),僅適用於類似原始YUV等沒有包含幀大小(WxH)的視頻 |
|
-pixel_format 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
參數 | 說明 | 原文 |
---|---|---|
-stats | 打印回放統計信息 | 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
# 多個濾鏡,不同種類參數,空格追加