C
C
computershik732020-02-24 00:24:06
linux
computershik73, 2020-02-24 00:24:06

Relay from HLS to RTSP?

The source file is an m3u8 file that contains links to ts-fragments of the broadcast and is dragged from one popular resource (without downloading it from there).
It is necessary to transcode to rtsp and spit out a link for the client. How to do it? ffmpeg reads packets endlessly and even flush_packets doesn't stop it.

ffmpeg -re -i https://server/playlist.m3u8?extra=6O3qK_54vxgC -f rtsp -fflags flush_packets -max_delay 2 -muxdelay 0.1 -hls_flags delete_segments rtsp://localhost:9999/stream

other open source solutions like https://github.com/klaxa/mkvserver_mk2 scream about the wrong file extension and try to save the broadcast to a file. I also need to transfer live broadcasts to an rtsp stream on the fly.
Well and accordingly what to use as the server, interests. https://github.com/revmischa/rtsp-server tried it, it is not completely friendly with ffmpeg, when you try to connect the player (vlc) to the stream, it swears at something.
live555 - not at all.

vlc -vvv -I dummy https://server/360p/chunks.m3u8?extra=8iACFlCDWEu4vm --sout='#transcode{acodec=mp4a, aenc=ffmpeg}:rtp{mp4a-latm,dst=localhost,port= 9999,port-audio=9998,name=stream,sdp=rtsp://localhost:9999/stream}'
Does not give results, does not want to stream.

I solved the problem by changing the port and installing the actual IP instead of the localhost. New problem - the stream is unstable and crashes with the inscription "completed" on some devices. On a computer in vlc is stable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Drno, 2020-02-24
@Drno

in VLC add --loop - so that it spins incessantly
completed - this is your server stopped giving the stream. or the Internet has broken on the client
; also run vlc on the client with the --loop parameter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question