(Audio and video study notes): ffmpeg pulls and pushes

ffmpeg pull stream

[Live streaming]

  • Use ffplay to test whether the current code stream can be played normally
ffplay rtmp://server/live/streamName
  • -c is the same as -codec
ffmpeg -i rtmp://server/live/streamName -c copy dump.flv
  • For protocols other than rtmp, -c copy should be used with caution, such as the http protocol.
  • Example: CCTV1 HD: http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8
    • -c copy output is specified in ts format, and flv format is used to report an error
ffmpeg -i http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8 -c copy cctv1.ts
  • Do not use -c copy, the output is in flv format, audio and video are automatically transcoded
ffmpeg -i http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8 cctv1.flv
  • Use specified transcoding when outputting
ffmpeg -i http://ivi.bupt.edu.cn/hls/cctv1hd.m3u8 -acodec aac -vcodec libx264 cctv1-2.flv

ffmpeg push stream

[Live streaming]

ffmpeg -re -i out.mp4  -c  copy flv rtmp://server/live/streamName

Guess you like

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