TVHeadend, pipe, sh script, ffmpeg, iptv error
Added by Rastislav Potocny over 6 years ago
Hi, I am trying to use pipe sh script in tvheadend but getting constantly error and IPTV mux with no scan data...
Here is my setup:
CoreELEC 8.95, TVheadend 4.2.6
In TVheadend, DVB inputs, IPTV, URL is:
pipe:///storage/downloads/sledovanitv.sh
sledovanitv.sh script looks like:
#!/bin/bash ffmpeg -i "http://31.47.108.4:7909/moderntv/stream/prima/40-hls/live-media.m3u8?_cdn_session=XZY&_cdn_timestamp=XZY&_cdn_token=XZY" -f mpegts -vcodec copy -acodec copy pipe:1
This is failed in TVheadend:
2018-08-10 19:37:00.075 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.087 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.099 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.111 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.123 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.135 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.147 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.159 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.171 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.183 spawn: Executing "/storage/downloads/sledovanitv.sh" 2018-08-10 19:37:00.194 mpegts: pipe:///storage/downloads/sledovanitv.sh in IPTV - scan no data, failed
When I execute script from shell with routed output to > file, everything works just fine and video is being streamed and downloaded to file
CoreELEC:~/downloads # sh sledovanitv.sh ffmpeg version 8.95.0 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 8.1.0 (GCC) configuration: --enable-ffmpeg --disable-ffplay --enable-ffprobe --enable-static --disable-shared --enable-gpl --enable-nonfree --disable-doc --enable-avresample --disable-lzma --disable-alsa --arch=arm --cpu=cortex-a53 --cross-prefix=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/armv8a-libreelec-linux-gnueabi- --enable-cross-compile --sysroot=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/armv8a-libreelec-linux-gnueabi/sysroot --sysinclude=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/armv8a-libreelec-linux-gnueabi/sysroot/usr/include --target-os=linux --nm=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/armv8a-libreelec-linux-gnueabi-nm --ar=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/armv8a-libreelec-linux-gnueabi-ar --as=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc --cc=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc --ld=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc --pkg-config=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/pkg-config --host-cc=/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/bin/host-gcc --host-cflags='-O2 -Wall -pipe -I/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/include -Wno-format-security' --host-ldflags='-Wl,-rpath,/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/lib -L/home/adamg/CoreELEC/build.CoreELEC-S905.arm-8.95.0/toolchain/lib' --host-extralibs=-lm --extra-cflags='-march=armv8-a+crc -mtune=cortex-a53 -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -fomit-frame-pointer -Wall -pipe -Os ' --extra-ldflags='-march=armv8-a+crc -mtune=cortex-a53 -Wl,--as-needed' --extra-libs= --enable-pic --enable-openssl --enable-hardcoded-tables libavutil 56. 14.100 / 56. 14.100 libavcodec 58. 18.100 / 58. 18.100 libavformat 58. 12.100 / 58. 12.100 libavdevice 58. 3.100 / 58. 3.100 libavfilter 7. 16.100 / 7. 16.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 1.100 / 5. 1.100 libswresample 3. 1.100 / 3. 1.100 libpostproc 55. 1.100 / 55. 1.100 frame= 503 fps=171 q=-1.0 Lsize= 6948kB time=00:00:20.13 bitrate=2826.2kbits/s speed=6.83x
Also when I even pipe from TVheadend just ffmpeg it works:
pipe:///storage/.kodi/addons/tools.ffmpeg-tools/bin/ffmpeg -i "http://31.47.108.4:7909/moderntv/stream/prima/40-hls/live-media.m3u8?_cdn_session=XZY&_cdn_timestamp=XZY&_cdn_token=XZY" -f mpegts -vcodec copy -acodec copy pipe:1
Only when I tried to use pipe *.sh script it fails, can somebody help me or point me to right direction ?
Thanks
Replies (8)
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by saen acro over 6 years ago
With user and group used to start TVH?
Is they are same with use run script manual?
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by Rastislav Potocny over 6 years ago
I do run script under root, see attached screen for available users in tvheadend, I am not logged under any user, just using IP and login to TVHeadend.
Is this related ?
Thanks
Clipboard01.jpg (17.8 KB) Clipboard01.jpg |
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by saen acro over 6 years ago
Tvh service is normally not run by root account.
service Use command:
/usr/bin/tvheadend -f -p /var/run/tvheadend.pid -u hts -g video
aka
user hts
group video
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by Rastislav Potocny over 6 years ago
Thanks a lot for your input but I am bit novice to Linux...
What do I need to do with the command, execute on boot ? or use command somewhere in TVheadend ?
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by Rastislav Potocny over 6 years ago
I did read and understand, tvheadend is running under user hts.
I still can not get this working, what to put to script for ffmpeg and what for URL.
Does pipe command need to change something ? Does script need to change ?
pipe:///storage/downloads/sledovanitv.sh
When I run from shell, it will not connect:
#!/bin/bash su - root -c "ffmpeg -re -fflags +genpts -i http://31.47.108.7:7909/moderntv/stream/prima/40-hls/live-media.m3u8?_cdn_session=ZXY&_cdn_timestamp=ZXY&_cdn_token=ZXY -f mpegts -vcodec copy -acodec copy pipe:1 > asd.ts"
Also does not work:
#!/bin/bash su - root -c "ffmpeg -re -fflags +genpts -i "http://31.47.108.7:7909/moderntv/stream/prima/40-hls/live-media.m3u8?_cdn_session=ZXY&_cdn_timestamp=ZXY&_cdn_token=ZXY" -f mpegts -vcodec copy -acodec copy pipe:1 > asd.ts"
This works:
#!/bin/bash ffmpeg -re -fflags +genpts -i "http://31.47.108.7:7909/moderntv/stream/prima/40-hls/live-media.m3u8?_cdn_session=ZXY&_cdn_timestamp=ZXY&_cdn_token=ZXY" -f mpegts -vcodec copy -acodec copy pipe:1 > asd.ts
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by saen acro over 6 years ago
#EXTM3U #EXTINF:-1 tvg-name="Name of service HD" tvg-id="channel-tvg-id" group-title="IPTV" tvg-logo="https://hd.png",Name of service HD pipe:///usr/bin/ffmpeg -loglevel fatal -i https://url.to.m3u8 -vcodec copy -acodec copy -metadata service_name=Name\ of\ service\ HD -metadata service_provider=IPTV-Provider -mpegts_service_type advanced_codec_digital_hdtv -f mpegts pipe:1
RE: TVHeadend, pipe, sh script, ffmpeg, iptv error - Added by Rastislav Potocny over 6 years ago
Thanks for help & finding way around however I am still concerned why I can't successfully execute script (ffmpeg) via pipe from tvheadend but it does work from shell