[FFmpeg-user] rebroadcasting an m3u8 stream (HLS)

Moritz Barsnick barsnick at gmx.net
Wed Dec 2 11:31:01 CET 2015


On Wed, Dec 02, 2015 at 01:11:00 -0500, chovy wrote:
> I'm trying to decrypt and rebroadcast a stream so I can play it in
> VLC, which is working (sort of), except on my server it can't seem to
> keep up while transcoding the live stream.

I don't know much about HLS decryption, but perhaps I can help
anyway...

> I'm trying to figure out some optimal options for ffmpeg:
> 
> ffmpeg \
> -user-agent 'iPhone' \
> -headers 'Cookie: <cookie>' \
> -i <encrypted-stream-1200.m3u8> \
> -hls_flags delete_segments \
> -hls_allow_cache 0 \
> mystream.m3u8 &

It would be extremely helpful to see the full, uncut console output of
ffmpeg (including the full command line). It would e.g. tell us at how
many fps your ffmpeg manages to re-encode, and whether that is the
issue.

Generally speaking: You may have to leverage encoding quality or
bandwidth for speed (those are the three factors you can vary between).
Assuming your ffmpeg encodes with libx264 (that's why we want logs
here, guessing is stupid!), you can create a stream with larger
bandwidth consumption but faster encoding, at (approx.) the same
quality, by changing the default preset ("medium") to something faster,
such as "fast" or "veryfast":

$ ffmpeg [...] -c:v libx264 -preset veryfast [...]

Furthermore, is there anything that can be copied from the stream,
despite decryption? (As I mentioned, I know little about how this
encryption works.) If decryption happens at container level, you could
copy the streams ("-c copy"), which is very fast. If decryption happens
at stream level, but audio is unencrypted, you can at least copy the
audio: "-c:a copy".

Show us your console output, please!

Cheers,
Moritz


More information about the ffmpeg-user mailing list