Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HLS-stream to TV example #338

Open
thomasschmiedl opened this issue Aug 19, 2018 · 6 comments
Open

HLS-stream to TV example #338

thomasschmiedl opened this issue Aug 19, 2018 · 6 comments

Comments

@thomasschmiedl
Copy link

Hello,
I try to display some HLS-streams on my TV (e.g. this webcam: https://www.skylinewebcams.com/de/webcam/czech-republic/prague/prague/old-town-bridge-tower.html). Is it possible to use the gerbera transcoding (calling the m3u8-playlist in ffmpeg and output to the fifo). Please provide an example. I will install gerbera on my router.

Thanks,
Thomas

@elmodaddyb
Copy link
Member

The ffmpeg transcoding in Gerbera uses a variable buffer (which you can configure). This may help you overcome the streaming nature of the m3u8 playlist on the internet.

The transcoding system transcodes a stream into a temporary file stored on the hard drive...typically something like/tmp/mt_123123123 and then wires up a separate transcoding thread running the FFMPEG command outputing a stream to serve it via UPNP HTTP protocol.

Once the stream is closed, it cleans up the transcoding process and deletes the temporary file.

I found this thread about a command you could use to transcode m3u8 playlist using FFMPEG:

https://stackoverflow.com/questions/32528595/ffmpeg-mp4-from-http-live-streaming-m3u8-file

You may have a challenge to accomplish this transcoding resident on a router. 😞

@elmodaddyb
Copy link
Member

Upon thinking, I have not tried transcoding a remote resource. Only local filesystem resident content. We would have to try out the External URL Object type to see if it flows through the transcoding profiles.

@thomasschmiedl
Copy link
Author

For a first test, I have tried these settings:

Entry:

in config.xml:
<transcoding enabled="yes"> <mimetype-profile-mappings> <transcode mimetype="application/x-mpegURL" using="ffmpeg"/> </mimetype-profile-mappings> <profiles> <profile name="ffmpeg" enabled="yes" type="external"> <mimetype>video/mp4</mimetype> <accept-url>yes</accept-url> <first-resource>yes</first-resource> <accept-ogg-theora>no</accept-ogg-theora> <agent command="ffmpeg" arguments="-i %in -c copy -f mp4 - > %out 2>/dev/null"/> </profile> </profiles> </transcoding>

ffmpeg returns this error:
'[NULL @ 0xa1f4be0] Unable to find a suitable output format for '>' >: Invalid argument'

A beginner question: When writing the output to the fifo (%out), what is the file-size? Because the router has only limited disk-space for writing.

@elmodaddyb
Copy link
Member

There is an attribute you can set for the CurlIOHandler that will set the buffer & fill sizes.

/transcoding/attribute::fetch-buffer-size
/transcoding/attribute::fetch-buffer-fill-size

https://github.com/gerbera/gerbera/blob/master/src/transcoding/transcode_ext_handler.cc#L180

@thomasschmiedl
Copy link
Author

I have edited the agent-parameters to:
<agent command="ffmpeg" arguments="-y -i %in -c copy -f mp4 %out"/>, but got this error:
"[mp4 @ 0x9f39920] muxer does not support non seekable output" and "Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument"

What are the correct ffmpeg parameters or output format? Do you know an other app for the HLS-downloading? Or is it planned to implement HLS-support to Gerbera?

@whyman
Copy link
Member

whyman commented Aug 20, 2018

I doubt we would support HLS directly in gerbera as its outside of the MediaServer remit.

As for getting the HLS to work with ffmpeg that's not really something we can help with either. Maybe try using something like streamlink as the input?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants