FFmpeg İle Restream

Ocak 30th, 2019 § Yorum yok

Re-streaming is when a server broadcasts an encoded video file as though it were a live stream. To re-stream using FFmpeg, use the -re option when encoding the video file for Wowza Streaming Engine™ media server software. The -re option instructs the encoder to read the source at its native frame rate. This slows the stream down to simulate live streaming and mitigates buffering and memory buildup that can disrupt playback.

Note: FFmpeg is updated frequently. Download the current version and read current documentation at ffmpeg.org.

Contents
Re-stream sample.mp4
Re-stream using passthrough
Re-stream RTSP with password authentication
Re-stream RTP with SDP
Re-stream UDP-based MPEG-TS
Re-stream TCP-based MPEG-TS
Re-stream UDP-based RTSP
Re-stream TCP-based RTSP
Re-stream RTMP
Re-stream to MP4

Re-stream sample.mp4

In a Terminal window, enter one of the following commands.
For a low-bitrate, low-complexity, low-quality stream that can be played on most devices and systems:

ffmpeg -re -i "%WMSAPP_HOME%/content/sample.mp4" -pix_fmt yuv420p -vsync 1 -threads 0 -vcodec libx264 -r 30 -g 60 -sc_threshold 0 -b:v 512k -bufsize 640k -maxrate 640k -preset veryfast -profile:v baseline -tune film -acodec aac -b:a 128k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -bsf:v h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316

For a higher-quality stream:

ffmpeg -re -i "%WMSAPP_HOME%/content/sample.mp4" -pix_fmt yuv420p -vsync 1 -threads 0 -vcodec libx264 -r 30 -g 60 -sc_threshold 0 -b:v 640k -bufsize 768k -maxrate 800k -preset veryfast -profile:v baseline -tune film -acodec aac -b:a 128k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -bsf:v h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316

Re-stream using passthrough
Content can also be re-streamed by passing the existing encode though FFmpeg without re-encoding. For passthrough re-streaming, use the -codec option and set it to copy. This example re-streams sample.mp4 as a passthrough instead of the full encode shown in the previous example.

ffmpeg -re -i "%WMSAPP_HOME%/content/sample.mp4" -codec copy -bsf:v h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316

Re-stream RTSP with password authentication
This example re-streams sample.mp4 with user authentication, level 3.0 logging verbosity, a 24-fps frame rate, 2-second keyframe frequency, 310 kbps bitrate, and 44.1 kHz stereo audio.

ffmpeg -re -i "%WMSAPP_HOME%/content/sample.mp4" -pix_fmt yuv420p -vsync 1 -threads 0 -vcodec libx264 -r 30 -g 60 -sc_threshold 0 -b:v 640k -bufsize 768k -maxrate 800k -preset veryfast -profile:v baseline -tune film -acodec aac -b:a 128k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -f rtsp rtsp://username:password@[wowza-address]:1935/live/myStream

Re-stream RTP with SDP
This example captures local hardware devices, uses a 15-fps frame rate, 8-bit color, and generates an SDP file that contains metadata about the streaming session.

ffmpeg -f dshow -s 640x480 -r 15 -i video="Logitech HD Pro Webcam C920" -f dshow -i audio="Microphone (HD Pro Webcam C920)" -pix_fmt yuv420p -vsync 1 -threads 0 -vcodec libx264 -r 15 -g 30 -sc_threshold 0 -b:v 640k -bufsize 768k -maxrate 800k -preset veryfast -profile:v baseline -tune film -an -f rtp rtp://127.0.0.1:10000 -acodec aac -b:a 128k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -vn -f rtp rtp://127.0.0.1:10002 > 10000.sdp

Re-stream UDP-based MPEG-TS
In a Terminal window, enter:

ffmpeg -re -i inputfile.mp4 -codec copy -bsf:v h264_mp4toannexb -f mpegts udp://[wowza-address]:1234?pkt_size=1316

Re-stream TCP-based MPEG-TS
In a Terminal window, enter:

ffmpeg -re -i inputfile.mp4 -codec copy -bsf:v h264_mp4toannexb -f mpegts tcp://[wowza-address]:1234?listen

Re-stream UDP-based RTSP
In a Terminal window, enter:

ffmpeg -re -i inputfile.mp4 -codec copy -f rtsp rtsp://username:password@[wowza-address]:1935/live/myStream

Re-stream TCP-based RTSP
In a Terminal window, enter:

ffmpeg -re -i inputfile.mp4 -codec copy -rtsp_transport tcp -f rtsp rtsp://username:password@[wowza-address]:1935/live/myStream

Re-stream RTMP
In a Terminal window, enter:

ffmpeg -re -i inputfile.mp4 -codec copy -f flv rtmp://username:password@[wowza-address]:1935/live/myStream

Re-stream to MP4
In a Terminal window, enter:

ffmpeg -re -i inputfile.mp4 -codec copy -f mp4 output.mp4

Kaynak:https://www.wowza.com/docs/how-to-live-stream-using-ffmpeg-with-wowza-streaming-engin

Bir cevap yazın

E-posta hesabınız yayımlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir

Ne yapıyorum ben!?

FFmpeg İle Restream başlıklı yazıyı okuyorsun.

Üst Veri