[SOLVED] ffmpeg pipe not working
Added by Marcos Santos almost 2 years ago
I'm having trouble getting the ffmpeg pipe to work on my tvheadend, I'm running Tvheadend version 4.3-2064~gabcb0ea67-dirty on Enigma2.
What happens is that if I run ffmpeg directly over ssh everything works perfectly, the command looks like this:
/usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts test.ts
Now if I run it on tvheadend via pipe, using the command like this:
pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1
My tvheadend log looks like this:
2022-12-15 00:46:26.999 mpegts: pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1 - tuning on IPTV #1
2022-12-15 00:46:27.009 subscription: 0009: "HTTP" subscribing to service "IPTV/pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 --filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1/TCM", weight: 100, adapter: "IPTV #1", network: "IPTV", mux: "pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1",
2022-12-15 00:46:27.010 spawn: Executing "/usr/bin/ffmpeg"
2022-12-15 00:46:27.030 iptv: stdin pipe 46 unexpectedly closed: No data
2022-12-15 00:46:43.009 subscription: 0009: service instance is bad, reason: No input detected
2022-12-15 00:46:43.009 mpegts: pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1 - tuning on IPTV #2
2022-12-15 00:46:43.020 subscription: 0009: "HTTP" subscribing to service "IPTV/pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 --filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1/TCM", weight: 100, adapter: "IPTV #2", network: "IPTV", mux: "pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1",
2022-12-15 00:46:43.020 spawn: Executing "/usr/bin/ffmpeg"
2022-12-15 00:46:43.040 iptv: stdin pipe 46 unexpectedly closed: No data
2022-12-15 00:46:47.820 webui: Stop streaming /stream/service/bed095263c541552f04ef73edf469970?ticket=f23fe58037ae1ccafb0a64a994bfb6d696527430, timeout waiting for packets
2022-12-15 00:46:47.820 subscription: 0009: "HTTP" unsubscribing, hostname="192.168.1.1", client="VLC/3.0.17.4 LibVLC/3.0.17.4"
2022-12-15 00:46:47.830 mpegts: pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1 - tuning on IPTV #1
2022-12-15 00:46:47.841 subscription: 000A: "HTTP" subscribing to service "IPTV/pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 --filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1/TCM", weight: 100, adapter: "IPTV #1", network: "IPTV", mux: "pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1",
2022-12-15 00:46:47.842 spawn: Executing "/usr/bin/ffmpeg"
2022-12-15 00:46:47.862 iptv: stdin pipe 46 unexpectedly closed: No data
2022-12-15 00:47:03.831 subscription: 000A: service instance is bad, reason: No input detected
2022-12-15 00:47:03.831 mpegts: pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1 - tuning on IPTV #2
2022-12-15 00:47:03.842 spawn: Executing "/usr/bin/ffmpeg"
2022-12-15 00:47:03.843 subscription: 000A: "HTTP" subscribing to service "IPTV/pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 --filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1/TCM", weight: 100, adapter: "IPTV #2", network: "IPTV", mux: "pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1",
2022-12-15 00:47:03.862 iptv: stdin pipe 46 unexpectedly closed: No data
2022-12-15 00:47:07.831 webui: Stop streaming /stream/service/bed095263c541552f04ef73edf469970?ticket=f23fe58037ae1ccafb0a64a994bfb6d696527430, timeout waiting for packets
2022-12-15 00:47:07.831 subscription: 000A: "HTTP" unsubscribing, hostname="192.168.1.1", client="VLC/3.0.17.4 LibVLC/3.0.17.4"
Any idea what might be going on?
Replies (16)
RE: ffmpeg pipe not working - Added by Hiro Protagonist almost 2 years ago
I'm puzzled why your log shows '/TCM' appended to your pipe: entries.
Do you get a valid mux entry from your configuration? Are you able to scan it?
RE: ffmpeg pipe not working - Added by Marcos Santos almost 2 years ago
Yes, I believe this point is strange too.
As for the mux, apparently everything is ok, I have a network called IPTV, so I created a Mux on that Network and added the Pipe command to the URL, the scan result is "Fail" with the Pipe command, but if I remove the pipe command leaving only the stream URL, the scan changes to "ok" and the stream works.
The URL I refer to that works is this:
http://192.168.1.55:9981/stream/channelnumber/659
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
Could you bring up the Edit Mux window for that MUX and post a screen grab of it's contents?
Your log shows that you are subscribing to a service, so at some point the MUX must have scanned OK and created a service. You might delete that service then go back, Edit the MUX and double check everything there. Switch the Scan status to PEND then save. Watch the log and see if it scans in a service.
RE: ffmpeg pipe not working - Added by Marcos Santos almost 2 years ago
Sure, no problem!
I uploaded the photo so you can take a look.
As for the service, it was created using the URL without the Pipe command, so it was possible to generate the service.
I deleted the service and tried what you suggested, apparently everything is ok, but I keep getting "no data" in the log...
Tvheadend Pipe .jpg (113 KB) Tvheadend Pipe .jpg |
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
Missing some parts of window and URL: due to scroll.
Not sure if these matter, but try not setting Character set:
I generally select Accept zero value for TSID:
If you enter a Mux name: It will tidy things up but probably not affect scanning.
I don't see where the /TCM is coming from.
RE: ffmpeg pipe not working - Added by Marcos Santos almost 2 years ago
Sorry, my fault.
I made the suggested changes, scanned the Mux again and took another print.
This is the scan log:
2022-12-19 18:41:21.560 mpegts: pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1 - tuning on IPTV #1
2022-12-19 18:41:21.591 spawn: Executing "/usr/bin/ffmpeg"
2022-12-19 18:41:21.591 subscription: 001F: "scan" subscribing to mux "pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1", weight: 6, adapter: "IPTV #1", network: "IPTV", service: "Raw PID Subscription"
2022-12-19 18:41:21.630 iptv: stdin pipe 44 unexpectedly closed: No data
2022-12-19 18:41:36.563 mpegts: pipe:///usr/bin/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1 - scan no data, failed
2022-12-19 18:41:36.563 subscription: 001F: "scan" unsubscribing
The TCM in the previous log could be a holdover from the edit I made to the Mux, because I had first put this address in the Mux URL:
http://192.168.1.55:9981/stream/channelnumber/659
Then I edited it and changed it to the pipe command.
As I mentioned, if I put only the URL in the Mux, without the Pipe command, the Scan result is "Ok" and I can map the service and watch the channel.
As for FFmpeg, that's ok too, if I type the command in ssh the conversion works.
Tvheadend Pipe .jpg (113 KB) Tvheadend Pipe .jpg | |||
Tvheadend Pipe .jpg (113 KB) Tvheadend Pipe .jpg |
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
I can't spot any issue with your mux config.
Do all pipe:// type MUX creations fail or just when you are looping back a channel from your own TVH server such as this one?
Is your original channel source tuned from DVB or is it an IPTV stream?
Might be a bug of some type due to ARM architecture or possibly a side effect of your config option choices when compiling TVH.
Turning debug and trace logging on for things like mpegts,spawn,subscription,iptv might turn up some clue.
RE: ffmpeg pipe not working - Added by Marcos Santos almost 2 years ago
I had not thought of testing with an IPTV stream, but it was a great idea, I have some on my server, I tested with them and the log remains the same... it seems that tvheadend does not understand the pipe command.
At first all MUX creations with pipe:// fail, I tested it now with some IPTV streams and none worked...
The source of the channel that I was initially trying to get through ffmpeg is tuned to DVB...
Turning debug and trace logging on for things like mpegts,spawn,subscription,iptv might turn up some clue.
How do I do it?
Thank you very much for all your help and attention!
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
Debugging tab under Configuration menu. Select both Debug and Debug trace options. In both Debug and Trace subsystems enter comma separated list of systems like was mentioned, then click Apply configuration. Bring up the log window by clicking on the arrows button at very bottom right hand side. When that opens there will be a second button beside arrows. Click to enable debug output. Log window will show Loglevel debug: enabled. Now as you try things extra debugging messages will show that might give some help.
RE: ffmpeg pipe not working - Added by clint jones almost 2 years ago
Curious,
what are you trying to accomplish by using the pipe? for real whats the purpose of looping your channel around in a circle?
thanks
clint
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
This thread is a carry on from another thread where the problem was presented. In this case the channel has multiple languages but instead of putting each language on it's own audio pid so you can select the language you want they put one language on the L audio channel and the other on the R audio channel. On most players you can't select just the L or just the R. This ffmpeg pipe remaps the R channel to both stereo channels so only his preferred language is heard.
Unfortunately cannot seem to get the pipe to run on the custom compiled version built for ARM.
RE: ffmpeg pipe not working - Added by clint jones almost 2 years ago
I'm far from an expert but when I get a playlist from tvheadend my channels look different
and if you run http://192.168.1.55:9981/playlist on yours can you replace what you get in the pipe an see if the results are different?
also Mp2 might not be available on pass maybe ac2 ac3 or just -c:a copy would work
when I put my link in VLC then look at the codec information I get
Codec: A52 aka ac3 a52 , for the audio information this is in the states not sure where you are located
Also wondering when you ran it over SSH you mention it ran good Does that mean you heard audio somehow or just not seeing any complaints from FFmpeg?
Clint
Clint
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
There are a number of url formats available to stream a channel from a TVH server. See Help --> Appendix 1
mp2 is an acceptable audio codec for a TS container. It must be encoded in order to remap the L/R channels.
He gave me a dyndns to access the channel stream from his server. I was able to add a new MUX using this exact pipe:// url and have it scan in a new service. The service played fine with just the one language audible.
He can stream the channel locally. He can run the ffmpeg command via ssh to create a TS file that plays with just the one language audible. Just cannot get TVH to initialize the pipe and create a new service on his system. I can only assume it's a glitch due to compiling for ARM. On my TVH server running on x86_64 I use these types of pipe:// urls to fix audio on channels fairly often.
RE: ffmpeg pipe not working - Added by Ron L almost 2 years ago
I wonder if /usr/bin/env would work instead...
pipe:///usr/bin/env ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c:v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1
RE: ffmpeg pipe not working - Added by Marcos Santos almost 2 years ago
Sorry for the delay, I was a little busy here, I ended up seeing the messages only now.
I enabled debugging for the suggested items and it didn't bring up many clues beyond what we already had, I ended up forgetting to comment, sorry.
I also did a new test using the URL suggested in Ron's last post and I still get the "No Data" message.
I tested the URL with some working IPTV channels I have on my server as well, I still get the "No Data" message.
As Ron commented, I can run ffmpeg smoothly via SSH, the audio is converted and works as expected, however the Pipe command always returns the message "No Data".
Given that, I can only think that it could be some bug in the ARM compilation, I believe that the development team would have to take a look.
If you have any more suggestions, I'd be very happy to try it out, if ffmpeg worked with Tvheadend it would be very useful for me.
Thanks a lot for the help guys!
RE: ffmpeg pipe not working - Added by Marcos Santos over 1 year ago
I managed to resolve this issue.
If anyone has difficulty making FFmpeg work with Tvheadend in enigma2, follow the step by step I used to solve the problem:
Install FFmpeg on Enigma2 following this step by step:
https://gist.github.com/jmsaavedra/62bbcd20d40bcddf27ac
The main point is that the installation is done in the /usr/local/bin folder instead of /usr/bin.
When placing the link in TVHeadend use the path /usr/local/bin/ffmpeg/ffmpeg
The URL will look something like this:
pipe:///usr/local/bin/ffmpeg/ffmpeg -i http://192.168.1.55:9981/stream/channelnumber/659 -filter_complex "channelmap=map=FR-FL|FR-FR:channel_layout=stereo" -c: v copy -c:a mp2 -mpegts_flags system_b -f mpegts pipe:1
And that's it!
Hope this helps someone.