Custom MPEG-TS Input » History » Revision 10
Revision 9 (Jaroslav Kysela, 2014-11-17 23:33) → Revision 10/28 (Nicolas C, 2014-11-18 11:40)
h1. Custom MPEG-TS Input
h2. Requirement
The TVHeadend 3.9.2100 and up for the pipe:// URL support. Note that TVHeadend expects the input in the raw MPEG-TS format with correct PAT/PMT tables.
h2. IPTV URLs
Note: Always try the command without pipe:// prefix on standard command line, if it works with a stdout redirection to a file!!
h3. Internet Radios
Unfortunately ffmpeg can't set the right header for Radios, so they'll show up as TV Channels :(. So while its not ideal, you can show a static image (the Radio Logo maybe?)
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -nostdin -loop 1 -y -i /path/to/image.png -re -i INPUTLINK -vcodec libx264 -acodec copy -mbd rd -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=RADIOPROVIDER -metadata service_name=RADIONAME -tune zerolatency -f mpegts pipe:!
</pre>
h3. Transcoding.
YMMV with different ffmpeg/libav versions. In Red Hat's (Fedora/Centos) build of ffmpeg, aac transcoding is experimental, so you have Transcode to enable -strict -2
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -nostdin -i INPUTLINK -vcodec libx264 -acodec aac -strict -2 -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1
</pre>
Try to transcode as little as possible, since it will impact your cpu usage. And if you're using tvheadend to re-transcode... well..
So if your channel already has aac audio, maybe you only need to transcode the H264 video stream.
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -nostdin -i INPUTLINK -vcodec libx264 -acodec copy -copyinkf -flags +ilme+ildct -fflags +genpts
-metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1
</pre>
h3. Direct copy
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -i INPUTLINK -vcodec copy -acodec copy -metadata service_provider=STRING
-metadata service_name=STRING -f mpegts -tune zerolatency pipe:1
</pre>
h2. Other solutions (HTTP proxy)
"A simple ffmpeg HTTP proxy using nodejs": https://github.com/Jalle19/node-ffmpeg-mpegts-proxy nodejs":https://github.com/Jalle19/node-ffmpeg-mpegts-proxy
h2. Requirement
The TVHeadend 3.9.2100 and up for the pipe:// URL support. Note that TVHeadend expects the input in the raw MPEG-TS format with correct PAT/PMT tables.
h2. IPTV URLs
Note: Always try the command without pipe:// prefix on standard command line, if it works with a stdout redirection to a file!!
h3. Internet Radios
Unfortunately ffmpeg can't set the right header for Radios, so they'll show up as TV Channels :(. So while its not ideal, you can show a static image (the Radio Logo maybe?)
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -nostdin -loop 1 -y -i /path/to/image.png -re -i INPUTLINK -vcodec libx264 -acodec copy -mbd rd -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=RADIOPROVIDER -metadata service_name=RADIONAME -tune zerolatency -f mpegts pipe:!
</pre>
h3. Transcoding.
YMMV with different ffmpeg/libav versions. In Red Hat's (Fedora/Centos) build of ffmpeg, aac transcoding is experimental, so you have Transcode to enable -strict -2
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -nostdin -i INPUTLINK -vcodec libx264 -acodec aac -strict -2 -copyinkf -flags +ilme+ildct -fflags +genpts -metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1
</pre>
Try to transcode as little as possible, since it will impact your cpu usage. And if you're using tvheadend to re-transcode... well..
So if your channel already has aac audio, maybe you only need to transcode the H264 video stream.
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -nostdin -i INPUTLINK -vcodec libx264 -acodec copy -copyinkf -flags +ilme+ildct -fflags +genpts
-metadata service_provider=STRING -metadata service_name=STRING -f mpegts -tune zerolatency pipe:1
</pre>
h3. Direct copy
<pre>
pipe:///usr/bin/ffmpeg -loglevel fatal -i INPUTLINK -vcodec copy -acodec copy -metadata service_provider=STRING
-metadata service_name=STRING -f mpegts -tune zerolatency pipe:1
</pre>
h2. Other solutions (HTTP proxy)
"A simple ffmpeg HTTP proxy using nodejs": https://github.com/Jalle19/node-ffmpeg-mpegts-proxy nodejs":https://github.com/Jalle19/node-ffmpeg-mpegts-proxy