FFmpeg command: from beginner to proficient | ffplay command to play media

FFmpeg command: from beginner to proficient | ffplay command to play media

In this section we introduce some practical examples of using the ffplay command to play media.

Play local files

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

ffplaybuweishui.mp3

Play network stream

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

force decoder

Force the use of mpeg4 decoder:

ffplay -vcodec mpeg4 test.mp4

Force the use of h264 decoder:

ffplay -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

parameter:

  • -pixel_format: YUV data format
  • -video_size: Specify video resolution
  • -framerate: frame rate, default value is 25

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

parameter:

  • -ar: Set the audio sampling rate (unit: Hz) (from 0 to INT_MAX), the default value is 0
  • -ac: Set the number of audio channels (from 0 to INT_MAX), the default value is 0
  • -f: Set sampling format

Guess you like

Origin blog.csdn.net/ProgramNovice/article/details/133441686