Restream m3u8 with python, ffmpeg or nginx - ffmpeg

I need to restream m3u8 videos to my service. The project is written in django. I can't get my m3u8 with ffmpeg command
ffmpeg -fflags +igndts -hide_banner -i https://link/stream.m3u8 -c copy -f flv rtmp:127.0.0.1/live/stream
Please tell me how do I do this?
ffmpeg -fflags +igndts -hide_banner -i https://link/stream.m3u8 -c copy -f flv rtmp:127.0.0.1/live/stream

Related

How to push mp3 to srs with ffmpeg?

I push my MP3 file like this:
ffmpeg.exe -re -stream_loop -1 -i ./ring.mp3 -c copy -f mp3 rtmp://${domain}/live/test
But the PotPlayer couldn't accept it well.
For FFmpeg, the format you should use flv instead of mp3, like this:
ffmpeg.exe -re -stream_loop -1 -i ./ring.mp3 -c copy \
-f flv rtmp://${domain}/live/test
# Or transcode the sample file of SRS
ffmpeg -re -i srs/trunk/doc/source.flv -vn -c:a libmp3lame \
-f flv rtmp://localhost/live/test
Then play by ffplay:
ffplay rtmp://localhost/live/test
Recommend to use AAC instead MP3, because AAC is more widely used, so you could transcode to aac by:
ffmpeg -f flv -i rtmp://localhost/live/livestream -c:v copy -c:a aac \
-f flv -y rtmp://localhost/live/test2
Note that WebRTC use opus as audio codec.

Encode youtube live stream to UDP out using youtube-dl and ffmpeg

I am trying to encode youtube live stream to UDP destination using youtube-dl and ffmpeg with below command
youtube-dl -f best --buffer-size 2M -o - "https://www.youtube.com/watch?v=tkUvWJiTf9A" | ffmpeg -re -f mp4 -i pipe:0 -codec copy -f mpegts udp://192.168.1.107:1234?pkt_size=1316
But its not working, its just downloading ts segments of that live stream.
When I am trying with video of youtube its working fine with below commands
youtube-dl -f best --buffer-size 2M -o - "https://www.youtube.com/watch?v=snDI6AaL04g" | ffmpeg -re -f mp4 -i pipe:0 -codec copy -f mpegts udp://192.168.1.107:1234?pkt_size=1316
Any help or suggestion appreciated.
I have got it solved using below command using Streamlink with ffmpeg. sharing so anyone needed can refer that.
streamlink --hls-segment-threads 10 --ringbuffer-size 10M https://www.youtube.com/watch?v=NMre6IAAAiU 140p,worst --stdout | ffmpeg -i pipe:0 -codec copy -bsf:v h264_mp4toannexb -f mpegts udp://192.168.2.7:1234?pkt_size=1316

ffmpeg play RTSP stream while recording

I successfully record to a file a RTSP stream using ffmpeg with the following command:
ffmpeg -i "rtsp://1.1.1.1:554/user=admin&password=admin&channel=1&stream=1" -acodec copy -vcodec copy -movflags frag_keyframe+empty_moov -y http://www.example.com/rec/1.mp4
now I need to play video while ffmpeg is still writing to file. Even changing file format, is it possible?
Pipe a 2nd output to ffplay
ffmpeg -i "rtsp://1.1.1.1:554/user=admin&password=admin&channel=1&stream=1" -acodec copy -vcodec copy -movflags frag_keyframe+empty_moov -y http://www.example.com/rec/1.mp4 -c copy -f nut - | ffplay

how to push a video list to rtmp server and keep connect

Current methods
ffmpeg -re -i 1.mp4 -f flv "rtmp://example.com/live"
ffmpeg -re -i 2.mp4 -f flv "rtmp://example.com/live"
ffmpeg -re -i 3.mp4 -f flv "rtmp://example.com/live"
...
but 1.mp4 push done later , client and server will be disconnected.
i hope keep connect.
Try concat demuxer.
Create a list (myfiles.txt):
file '1.mp4'
file '2.mp4'
file '3.mp4'
...
Then
ffmpeg -f concat -i myfiles.txt -f flv "rtmp://example.com/live"

ffmpeg copying rtmp stream, but without audio

I am sending stream to flash media server from Adobe Flash Media Live Encoder and I am trying to copy this stream to another FMS using FFmpeg
ffmpeg -analyzeduration 0 -i "rtmp://x.x.x.x/live/stream1 live=1" \
-vcodec copy -acodec copy -f flv rtmp://y.y.y.y/live/stream1
but there is no audio. Can anyone help me?
try like this :
ffmpeg -i "rtmp://x.x.x.x/live/stream1 live=1" \
-vcodec copy -acodec copy -f flv rtmp://y.y.y.y/live/stream1

Resources