(Audio and video study notes): ffplay command options and use cases

ffplay command options

  • -x width forces the display of broadband.
  • -y height Force display height.
ffplay -volume 1 -x 800 -y  -480 test.mp4
  • -video_size size frame size setting display frame storage (WxH format), only applicable to videos that do not contain frame size (WxH) like original YUV. such as:
ffplay -pixel_format yuv420p -video_size 320x240 -framerate 5 yuv420p_320x240.yuv
  • -pixel_format format format to set the pixel format.
  • -fs                                starts in full screen mode.
  • -an                               disable audio (do not play sound)
  • -vn                               disable video (do not play video)
  • -sn                               disable subtitles (do not display subtitles)
  • -ss pos                        position and drag according to the set seconds, pay attention to the time unit:
    • 比如'55' 55seconds, '12:03:45' ,12 hours, 03 minutes and 45 seconds, '23.189' 23.189second
  • -t duration                              sets the length of playing video/audio, the time unit is like -ss option
  • -bytes                                      Positioning and dragging in bytes (0=off 1=on -1=auto).
  • - seek_interval interval The custom left / right positioning drag interval (in seconds), the default value is 10 seconds (see the code does not implement)
  • -nodisp                                   close the graphical display window, the video will not be displayed
  • -noborder                               borderless window
  • -volume vol Set the starting volume. Volume range [0 ~100]
  • -f fmt                                        forces to use the set format for parsing. For example -f s16le
  • -window_title title                   sets the window title (the default is the input file name)
  • -loop number                          set the number of playback loops
  • -showmode mode                   sets the display mode, the available mode values ​​are: 0 shows video, 1 shows audio waveform, 2 shows audio spectrum. The default is 0, if the video does not exist, it will automatically select 2 (w key to switch back)
  • -vf filtergraph                          set video filter
  • -af filtergraph                         set audio filter
  • -stats                                       prints multiple playback statistics, including display stream duration, codec parameters, current position in the stream, and audio/video synchronization difference. It is enabled by default. To disable it explicitly, you need to specify -nostats. .
  • -fast                                         non-standardized multimedia compatibility optimization.
  • -genpts                                    generates pts.
  • -sync type The                               synchronization type sets the main clock to audio (type=audio), video (type=video) or external (type=ext). The default is audio as the main clock.
  • -ast audio_stream_specifier         specifies the audio stream index, such as -ast 3, play the audio stream with stream index 3
  • - VST video_stream_specifier         specified video stream index, such -vst 4, play a video stream stream index 4
  • -sst subtitle_stream_specifier     specifies the subtitle stream index, such as -sst 5, the subtitle stream with stream index 5 is played
  • -Autoexit                                         exits after the video is played.
  • -exitonkeydown                             keyboard press any key to exit playback
  • -exitonmousedown                       mouse down any key to exit playback
  • -codec:media_specifier                codec_name Force the use of the set multimedia decoder, the available values ​​of media_specifier are a (audio), v (video) and s subtitles.
    • For example, -codec:v h264_qsv forces the video to be decoded by h264_qsv
  • -acodec codec_name force to use the set audio decoder for audio decoding
  • - vcodec codec_name provided enforce video decoder for video decoding
  • -scodec codec_name Force the use of the set subtitle decoder for subtitle decoding
  • -autorotate automatically rotate the video based on the file metadata. The value is 0 or 1, and the default is 1.
  • -framedrop                                    Drop the video frame if the video is out of sync. When the main clock is not the video clock, it is turned on by default. If you need to disable it, use -noframedrop
  • -infbuf                                            does not limit the size of the input buffer. Read as much data as possible from the input as quickly as possible. It is enabled by default when playing a live stream. If the data is not read in time, the data may be discarded. This option will not limit the size of the buffer. If you need to disable it, use -noinfbuf
  • More reference: http://www.ffmpeg.org/ffplay.html

【Play local files】

ffplay -window_title "test time" -ss 2 -t 10 -autoexit test.mp4
ffplay buweishui.mp3

【Play network stream】

ffplay -window_title "rtmp stream" rtmp://202.69.69.180:443/webcast/bshdlive-pc

【Mandatory Decoder】

  • mpeg4 decoder:
fplay -vcodec mpeg4 test.mp4
  • h264 decoder:
fplay -vcodec h264 test.mp4

[Disable audio or video]

  • Disable audio:
ffplay test.mp4 -an
  • Disable video:
ffplay test.mp4 -vn

【Play YUV data】

 ffplay -pixel_format yuv420p -video_size 320x240 -framerate 5 yuv420p_320x240.yuv

【Play RGB data】

ffplay -pixel_format rgb24 -video_size 320x240 -i rgb24_320x240.rgb
ffplay -pixel_format rgb24 -video_size 320x240 -framerate 5 -i rgb24_320x240.rgb

【Play PCM data】

ffplay -ar 48000 -ac 2 -f f32le 48000_2_f32le.pcm
  • -ar set audio sampling rate (in Hz) (from 0 to INT_MAX) (default 0)
  • -ac set number of audio channels (from 0 to INT_MAX) (default 0)

Introduction to ffplay filter

【Video Rotation】

ffplay -i test.mp4 -vf transpose=1

【Video Reverse】

ffplay test.mp4 -vf hflip
ffplay test.mp4 -vf vflip

【Video Rotation and Reverse】

ffplay test.mp4 -vf hflip,transpose=1

【Audio variable speed playback】

ffplay -i test.mp4 -af atempo=2

[Video variable speed playback]

ffplay -i test.mp4 -vf setpts=PTS/2

[Simultaneous speed change of audio and video]

fplay -i test.mp4 -vf setpts=PTS/2 -af atempo=2

Guess you like

Origin blog.csdn.net/baidu_41388533/article/details/112253329