Project

General

Profile

TVHeadend Raspberry Pi and Transcoding

Added by lord slash about 10 years ago

Hi guys, I've setup a TVHeadend back end with my raspberry pi and raspbian, where I stream the italian tv to my home in Germany. The system works perfectly during the day, but in the evening the DSL bandwidth is not enough (I need around 4000kbps and I have 3000kbps).

Therefore I would like to try the TVHeadend transcoding option. According to this: https://tvheadend.org/boards/4/topics/13635?r=13637 I should compile after enabling the transcoding in the configuration file src/plumbing/transcoding.c The problem is that in this file there is no uint32_t transcoding_enabled at all. I tried a ./configure --enable-libffmpeg_static and then make and make install, but in the TVHeadend transcoding option is not there :(

What happened to the uint32_t transcoding_enabled ?? How should I compile in order to get transcoding work on my pi? By the way, I have TVHeadend 3.9.1879. Thanks in advance for the help!


Replies (160)

RE: TVHeadend Raspberry Pi and Transcoding - Added by Robert Mast over 7 years ago

Yes! I managed to get gst-launch OMX-transcoding a DVB-C MPEG2-stream to 2 mb/s to a file, I saw it work fully with the RPi1 and RPi3 with MPEG2-license. With the RPi2 I saw it work until the need of a MPEG2-license (which I didn't buy yet for this second hand RPi2), but the main demuxer worked there as well.

I saw synchronous audio and video (I had to absolutely minimize the software-transcoding of audio to get it work)

I needed no compiling, just installing, so no need for the transcoding compiled into TVHeadend and even no difficult selection of an audio stream.

I used berryboot and raspbian Jessie because berryboot makes the image interchangable between RPi1, 2 and 3 and installs the root filesystem on a USB3-stick that makes installing and upgrading twice as fast.

Steps:
Get the actual berryboot image of Raspbian Jessie (I got the initially offered 2016-7-27 version)

sudo apt-get update
sudo apt-get upgrade

(Berryboot doesn't update the boot-kernel during this procedure, but that doesn't matter)

Get all packages for gstreamer (I don't know if this installs unnecessary packages as well)

sudo apt-get install gstreamer1.0
sudo apt-get install gstreamer-1.0

Follow https://tvheadend.org/boards/5/topics/21528 for installing tvheadend. For the RPi1 there is a special dpkg-instruction on page 2, as the right armv6hf-package doesn't come with apt-get:
dpkg -i tvheadend_4.1-2332-g38c9e89_armhf.deb

Make tvheadend tune the channels, or just copy the /home/hts/.hts tree from some working TVHeadend-install.

En then the magic:

gst-launch-1.0 souphttpsrc location="http://127.0.0.1:9981/stream/channel/41ceb7b6ef96f869d7d6c78b6b3a27a6?ticket=24A946694272F14A9994F5F2280E466AB495F745?profile=pass" num-buffers=-1 ! tsdemux name=demux demux. ! queue ! mpegvideoparse ! omxmpeg2videodec ! videoconvert ! omxh264enc target-bitrate=2097152 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=720,height=576,framerate=25/1 ! h264parse ! mux. mpegtsmux name=mux ! filesink location=robert.mp4 demux. ! queue ! mpegaudioparse ! mux.

To get the aspect-ratio 16:9 right I had to use VLC which only was able to show this file correctly after resetting the settings.

I guess the last step, streaming over the network, will be a smaller one now.

As soon as I got that working I'll also have a look at the transcoding in TVHeadend earlier in this thread.
The quality of this OMX decoding/coding appears to be good enough to invest some more time in it to get it working straight from TVHeadend.

Gstreamer contains an executable, gst-discoverer-1.0, which can tell you what audio and video-format you need to get your stream decoded.
gst-inspect-1.0 will show you what elements are to be used in the gst-launch pipeline.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Antonio S over 7 years ago

Hi
I can confirm that the gst-launch command you provided works also with gst 1.10.3 I have self compiled on my Rpi3.
I'm transcoding a MPEG2 stream from DVB-T, I had to force the video format out from the decoding pipeline, because it seems it's not set correctly with this gst version, see my modified command:

gst-launch-1.0 souphttpsrc location="http://xxxxx::9981/stream/channelnumber/5?profile=pass" num-buffers=-1 ! tsdemux name=demux demux. ! queue ! mpegvideoparse ! omxmpeg2videodec ! video/x-raw,format=I420 ! videoconvert ! omxh264enc target-bitrate=2097152 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=720,height=576,framerate=25/1 ! h264parse ! mux. mpegtsmux name=mux ! filesink location=robert.mp4 demux. ! queue ! mpegaudioparse ! mux.

Comparing it to the command I was using, it seems it's confirmed that the issue is with the sync with audio track when attempting to transcode it. Now the problem is that, even if setting the output to a pipeline, the launch command is not that "user friendly", because it must be managed by hand. My goal was to set a IP Mux in TVHeaded that is launching the gst-stream to set the pipeline, so the transcoded channel can be watched with HTPS plugin also.
I try to make some experiment
Bye

RE: TVHeadend Raspberry Pi and Transcoding - Added by Antonio S over 7 years ago

Hi
Actually the audio transcoding works also:

gst-launch-1.0 souphttpsrc location="http://xxxx::9981/stream/channelnumber/5?profile=pass" num-buffers=-1 ! tsdemux name=demux demux. ! queue ! mpegvideoparse ! omxmpeg2videodec ! video/x-raw,format=I420 ! videoconvert ! omxh264enc target-bitrate=2097152 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=720,height=576,framerate=25/1 ! h264parse ! mux. mpegtsmux name=mux ! filesink location=robert.mp4 demux. ! queue ! mpegaudioparse ! mpg123audiodec ! audioconvert dithering=0 ! audio/x-raw,channels=2 ! fdkaacenc bitrate=65536 ! mux.

Now, merging everything I have set this command that should transcode into a stream, that can be used by http-launch or tvheadend:

gst-launch-1.0 souphttpsrc location="http://xxxx::9981/stream/channelnumber/5?profile=pass" num-buffers=-1 ! tsdemux name=demux demux. ! queue ! mpegvideoparse ! omxmpeg2videodec ! video/x-raw,format=I420 ! videoconvert ! omxh264enc target-bitrate=2097152 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=720,height=576,framerate=25/1 ! h264parse ! mpegtsmux name=stream demux. ! queue ! mpegaudioparse ! mpg123audiodec ! audioconvert dithering=0 ! audio/x-raw,channels=2 ! fdkaacenc bitrate=65536 ! stream.

But it doesn't work. With both http-launch and TVHeadend IP Mux, I see that the connection is made, the gst pipeline is started, but nothing is played, and after few seconds, the connection is just closed

RE: TVHeadend Raspberry Pi and Transcoding - Added by Antonio S over 7 years ago

Hi
Success, I have a working launch command for http-launch
The funny thing is that I had to add the streamable=true option in mpegtsmux, but gstreamer says that it's an unsupported property....

http-launch 9080 /xyz.ts verbose gst-launch-1.0 souphttpsrc location="http://xxxx::9981/stream/channelnumber/5?profile=mpeg2" num-buffers=-1 ! tsdemux name=demux demux. ! queue ! mpegvideoparse ! omxmpeg2videodec ! video/x-raw,format=I420 ! videoconvert ! omxh264enc target-bitrate=2097152 control-rate=variable ! video/x-h264,stream-format=byte-stream,profile=high,width=720,height=576,framerate=25/1 ! h264parse ! mpegtsmux name=stream streamable=true demux. ! queue ! mpegaudioparse ! mpg123audiodec ! audioconvert dithering=0 ! audio/x-raw,channels=2 ! fdkaacenc bitrate=65536 ! stream.

Now. I have set exactly this command (without http-launch of course) as pipe:// target of an IPTV mux in tvheadend, does anyone know how generate a channel from this IPTV mux????

RE: TVHeadend Raspberry Pi and Transcoding - Added by Gnag Flow over 7 years ago

hello,

i tried it with following command:

AUTOBUILD_CONFIGURE_EXTRA=--enable-libffmpeg_static ./Autobuild.sh

and getting this error message:

root@raspberrypi:/usr/src/tvheadend# ./Autobuild.sh
dpkg-buildpackage: Quellpaket tvheadend
dpkg-buildpackage: Quellversion 4.1-2442~g82aea16
dpkg-buildpackage: Quelldistribution unstable
dpkg-buildpackage: Quellen geändert durch Andreas Öman <[email protected]>
dpkg-buildpackage: Host-Architektur armhf
 dpkg-source --before-build tvheadend
 debian/rules clean
dh clean
dh: Compatibility levels before 9 are deprecated (level 5 in use)
   dh_testdir
   dh_clean
        rm -f debian/debhelper-build-stamp
        rm -f debian/tvheadend.substvars
        rm -f debian/tvheadend.*.debhelper
        rm -rf debian/tvheadend/
        rm -f debian/tvheadend-dbg.substvars
        rm -f debian/tvheadend-dbg.*.debhelper
        rm -rf debian/tvheadend-dbg/
        cp -an --reflink=auto debian/.debhelper/bucket/files/7e9899c07f0914a2eef77797a090156a0c68caab33a048f69945df0cef1d07db debian/.debhelper/bucket/files/7e9899c07f0914a2eef77797a090156a0c68caab33a048f69945df0cef1d07db.tmp
        mv -Tf debian/.debhelper/bucket/files/7e9899c07f0914a2eef77797a090156a0c68caab33a048f69945df0cef1d07db.tmp build.linux/ffmpeg/x264-snapshot-20160502-2245/config.guess
        cp -an --reflink=auto debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp
        mv -Tf debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp build.linux/ffmpeg/yasm-1.3.0/config/config.guess
        cp -an --reflink=auto debian/.debhelper/bucket/files/d789338930110770372af2861de6dc67bb83451d5240eb42b53064713935e681 debian/.debhelper/bucket/files/d789338930110770372af2861de6dc67bb83451d5240eb42b53064713935e681.tmp
        mv -Tf debian/.debhelper/bucket/files/d789338930110770372af2861de6dc67bb83451d5240eb42b53064713935e681.tmp build.linux/ffmpeg/x264-snapshot-20160502-2245/config.sub
        cp -an --reflink=auto debian/.debhelper/bucket/files/3cd488ca40af79af9b139188c440d64d3cf52eee56f4908907b61e12850646cf debian/.debhelper/bucket/files/3cd488ca40af79af9b139188c440d64d3cf52eee56f4908907b61e12850646cf.tmp
        mv -Tf debian/.debhelper/bucket/files/3cd488ca40af79af9b139188c440d64d3cf52eee56f4908907b61e12850646cf.tmp build.linux/ffmpeg/yasm-1.3.0/config/config.sub
        rm -rf debian/.debhelper/
        rm -f debian/*.debhelper.log
dh_clean: Compatibility levels before 9 are deprecated (level 5 in use)
        rm -f debian/files
        find .  \( \( \
                \( -path .\*/.git -o -path .\*/.svn -o -path .\*/.bzr -o -path .\*/.hg -o -path .\*/CVS \) -prune -o -type f -a \
                \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
                 -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
                 -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
                 -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
                \) -exec rm -f {} + \) -o \
                \( -type d -a -name autom4te.cache -prune -exec rm -rf {} + \) \)
 debian/rules build
dh build
dh: Compatibility levels before 9 are deprecated (level 5 in use)
   dh_testdir
   dh_update_autotools_config
        install -d debian/.debhelper/bucket/files
        cp -an --reflink=auto build.linux/ffmpeg/x264-snapshot-20160502-2245/config.guess debian/.debhelper/bucket/files/7e9899c07f0914a2eef77797a090156a0c68caab33a048f69945df0cef1d07db.tmp
        mv -f debian/.debhelper/bucket/files/7e9899c07f0914a2eef77797a090156a0c68caab33a048f69945df0cef1d07db.tmp debian/.debhelper/bucket/files/7e9899c07f0914a2eef77797a090156a0c68caab33a048f69945df0cef1d07db
        cp -f /usr/share/misc/config.guess ./build.linux/ffmpeg/x264-snapshot-20160502-2245/config.guess
        cp -an --reflink=auto build.linux/ffmpeg/yasm-1.3.0/config/config.guess debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp
        mv -f debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b.tmp debian/.debhelper/bucket/files/9be3de218833c076786b919dc34aab691611f4cd73316e7705f2673e2c41921b
        cp -f /usr/share/misc/config.guess ./build.linux/ffmpeg/yasm-1.3.0/config/config.guess
        cp -an --reflink=auto build.linux/ffmpeg/x264-snapshot-20160502-2245/config.sub debian/.debhelper/bucket/files/d789338930110770372af2861de6dc67bb83451d5240eb42b53064713935e681.tmp
        mv -f debian/.debhelper/bucket/files/d789338930110770372af2861de6dc67bb83451d5240eb42b53064713935e681.tmp debian/.debhelper/bucket/files/d789338930110770372af2861de6dc67bb83451d5240eb42b53064713935e681
        cp -f /usr/share/misc/config.sub ./build.linux/ffmpeg/x264-snapshot-20160502-2245/config.sub
        cp -an --reflink=auto build.linux/ffmpeg/yasm-1.3.0/config/config.sub debian/.debhelper/bucket/files/3cd488ca40af79af9b139188c440d64d3cf52eee56f4908907b61e12850646cf.tmp
        mv -f debian/.debhelper/bucket/files/3cd488ca40af79af9b139188c440d64d3cf52eee56f4908907b61e12850646cf.tmp debian/.debhelper/bucket/files/3cd488ca40af79af9b139188c440d64d3cf52eee56f4908907b61e12850646cf
        cp -f /usr/share/misc/config.sub ./build.linux/ffmpeg/yasm-1.3.0/config/config.sub
   debian/rules override_dh_auto_configure
make[1]: Entering directory '/usr/src/tvheadend'
dh_auto_configure --
dh_auto_configure: Compatibility levels before 9 are deprecated (level 5 in use)
        ./configure --build=arm-linux-gnueabihf --prefix=/usr --includedir=\${prefix}/include --mandir=\${prefix}/share/man --infodir=\${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --libexecdir=\${prefix}/lib/tvheadend --disable-maintainer-mode --disable-dependency-tracking
Checking support/features
  checking for cc execinfo.h ...                    ok
  checking for cc -mmmx ...                         fail
  checking for cc -msse2 ...                        fail
  checking for cc -Wunused-result ...               ok
  checking for cc getloadavg ...                    ok
  checking for cc atomic64 ...                      ok
  checking for cc atomic_time_t ...                 ok
  checking for cc bitops64 ...                      ok
  checking for cc lockowner ...                     ok
  checking for cc qsort_r ...                       ok
  checking for cc stime ...                         ok
  checking for cc gmtoff ...                        ok
  checking for cc recvmmsg ...                      ok
  checking for cc sendmmsg ...                      ok
  checking for cc libiconv ...                      ok
  checking for cc libdvben50221 ...                 ok
  checking for cc ifnames ...                       ok
  checking for py module gzip ...                   ok
  checking for pkg-config ...                       ok
  checking for xgettext ...                         ok
  checking for msgmerge ...                         ok
  checking for gzip ...                             ok
  checking for bzip2 ...                            ok
  checking for pkg openssl  ...                     ok (detected 1.0.1t)
  checking for cc linux/dvb/version.h ...           ok
  checking for pkg zlib  ...                        ok (detected 1.2.8)
  checking for pkg liburiparser  ...                ok (detected 0.8.0.1)
  checking for pkg avahi-client  ...                ok (detected 0.6.31)
  checking for cmake ...                            ok
  checking for cc -lstdc++ ...                      ok
  checking for cc nvEncodeAPI.h ...                 fail
  checking for cc sys/inotify.h ...                 ok
  fetching dvb-scan files ...                       ok
  checking for pkg dbus-1  ...                      ok (detected 1.8.22)

Compiler:
  Using C compiler:                        cc
  Using LD flags:                           -ldvben50221 -ldvbapi -lucsi
  Build for arch:                          arm

Binaries:
  Using PYTHON:                            python
  Using GZIP:                              gzip
  Using BZIP2:                             bzip2

Options:
  pie                                      yes
  ccdebug                                  no
  cwc                                      yes
  capmt                                    yes
  constcw                                  yes
  linuxdvb                                 yes
  satip_server                             yes
  satip_client                             yes
  hdhomerun_client                         yes
  hdhomerun_static                         yes
  iptv                                     yes
  tsfile                                   yes
  dvbscan                                  yes
  timeshift                                yes
  trace                                    yes
  imagecache                               yes
  avahi                                    yes
  zlib                                     yes
  libav                                    yes
  ffmpeg_static                            yes
  libx264                                  yes
  libx264_static                           yes
  libx265                                  yes
  libx265_static                           yes
  libvpx                                   yes
  libvpx_static                            yes
  libtheora                                yes
  libtheora_static                         yes
  libvorbis                                yes
  libvorbis_static                         yes
  libfdkaac                                yes
  libfdkaac_static                         yes
  nvenc                                    no
  qsv                                      no
  libmfx_static                            no
  inotify                                  yes
  epoll                                    yes
  uriparser                                yes
  ccache                                   no
  tvhcsa                                   yes
  bundle                                   no
  dvbcsa                                   no
  dvben50221                               yes
  kqueue                                   no
  dbus_1                                   yes
  android                                  no
  tsdebug                                  no
  gtimer_check                             no
  slow_memoryinfo                          no
  libsystemd_daemon                        no
  bintray_cache                            yes
  execinfo                                 yes
  W_unused_result                          yes
  getloadavg                               yes
  atomic64                                 yes
  atomic_time_t                            yes
  bitops64                                 yes
  lockowner                                yes
  qsort_r                                  yes
  stime                                    yes
  gmtoff                                   yes
  recvmmsg                                 yes
  sendmmsg                                 yes
  libiconv                                 yes
  libdvben50221                            yes
  ifnames                                  yes
  py_gzip                                  yes
  bin_pkg_config                           yes
  bin_xgettext                             yes
  bin_msgmerge                             yes
  bin_gzip                                 yes
  bin_bzip2                                yes
  ssl                                      yes
  linuxdvbapi                              yes
  upnp                                     yes
  bin_cmake                                yes
  stdcpp                                   yes
  libogg_static                            yes
  inotify_h                                yes
  linuxdvb_ca                              yes
  mpegts                                   yes
  mpegts_dvb                               yes

Packages:
  openssl                                  1.0.1t
  zlib                                     1.2.8
  liburiparser                             0.8.0.1
  avahi-client                             0.6.31
  dbus-1                                   1.8.22

Installation paths:
  Prefix:                                  /usr
  Binaries:                                ${prefix}/bin
  Libraries:                               ${prefix}/lib
  Data files:                              ${prefix}/share
  Man pages:                               /usr/share/man

Final Binary:
  /usr/src/tvheadend/build.linux/tvheadend

Tvheadend Data Directory:
  /usr/share/tvheadend

make[1]: Leaving directory '/usr/src/tvheadend'
   debian/rules override_dh_auto_build
make[1]: Entering directory '/usr/src/tvheadend'
make
make[2]: Entering directory '/usr/src/tvheadend'
make -f Makefile.ffmpeg
make[3]: Entering directory '/usr/src/tvheadend'
DOWNLOAD        https://dl.bintray.com/tvheadend/misc/staticlib//arm/ffmpeg-2b10f916f7e682ffca8271b2f385396076eaf696.tgz
--2017-01-23 10:52:14--  https://dl.bintray.com/tvheadend/misc/staticlib//arm/ffmpeg-2b10f916f7e682ffca8271b2f385396076eaf696.tgz
Auflösen des Hostnamen »dl.bintray.com (dl.bintray.com)«... 159.122.18.156
Verbindungsaufbau zu dl.bintray.com (dl.bintray.com)|159.122.18.156|:443... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 404 Not Found
2017-01-23 10:52:14 FEHLER 404: Not Found.

FAILED TO DOWNLOAD https://dl.bintray.com/tvheadend/misc/staticlib//arm/ffmpeg-2b10f916f7e682ffca8271b2f385396076eaf696.tgz (BUT THIS IS NOT A FATAL ERROR! DO NOT REPORT THAT!)
cd /usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux && cmake -G "Unix Makefiles" \
        -DCMAKE_INSTALL_PREFIX="/ffmpeg" \
        -DENABLE_SHARED:BOOL=OFF \
        ../../source
-- cmake version 3.6.2
-- Detected ARM target processor
-- Could NOT find NUMA (missing:  NUMA_ROOT_DIR NUMA_INCLUDE_DIR NUMA_LIBRARY)
CMake Warning (dev) in CMakeLists.txt:
  A logical block opening on the line

    /usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/source/CMakeLists.txt:110 (if)

  closes on the line

    /usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/source/CMakeLists.txt:114 (endif)

  with mis-matching arguments.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- x265 version 2.1
-- Configuring done
-- Generating done
-- Build files have been written to: /usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux
DESTDIR=/usr/src/tvheadend/build.linux/ffmpeg/build \
        make -C /usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux install
make[4]: Entering directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
make[5]: Entering directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
make[6]: Entering directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
make[6]: Leaving directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
make[6]: Entering directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
[  1%] Building CXX object common/CMakeFiles/common.dir/arm/asm-primitives.cpp.o
*** Error in `/usr/bin/c++': double free or corruption (top): 0x005817e8 ***
Aborted
common/CMakeFiles/common.dir/build.make:62: recipe for target 'common/CMakeFiles/common.dir/arm/asm-primitives.cpp.o' failed
make[6]: *** [common/CMakeFiles/common.dir/arm/asm-primitives.cpp.o] Error 134
make[6]: Leaving directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
CMakeFiles/Makefile2:279: recipe for target 'common/CMakeFiles/common.dir/all' failed
make[5]: *** [common/CMakeFiles/common.dir/all] Error 2
make[5]: Leaving directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
Makefile:127: recipe for target 'all' failed
make[4]: *** [all] Error 2
make[4]: Leaving directory '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/build/linux'
Makefile.ffmpeg:238: recipe for target '/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/.tvh_build' failed
make[3]: *** [/usr/src/tvheadend/build.linux/ffmpeg/x265_2.1/.tvh_build] Error 2
make[3]: Leaving directory '/usr/src/tvheadend'
Makefile:756: recipe for target '/usr/src/tvheadend/build.linux/ffmpeg/build/ffmpeg/lib/libavcodec.a' failed
make[2]: *** [/usr/src/tvheadend/build.linux/ffmpeg/build/ffmpeg/lib/libavcodec.a] Error 2
make[2]: Leaving directory '/usr/src/tvheadend'
debian/rules:11: recipe for target 'override_dh_auto_build' failed
make[1]: *** [override_dh_auto_build] Error 2
make[1]: Leaving directory '/usr/src/tvheadend'
debian/rules:5: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: Fehler: Fehler-Exitstatus von debian/rules build war 2

hope you can help me.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Robert Mast over 7 years ago

Gnag Flow wrote: ...

You should also disable h265, earlier in this thread I (among others) also formulated a compile statement for TVHeadend, including this. Furthermore, it seems your Makefile.ffmpeg is too old, while it points to a nonexistent repository (the 404). You should get a more recent TVHeadend source.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Robert Mast over 7 years ago

Antonio S wrote:

Hi
Success, I have a working launch command for http-launch

Great! As http-launch uses multiple and unpredictable ports I don't expect it to be our final solution though.

Now. I have set exactly this command (without http-launch of course) as pipe:// target of an IPTV mux in tvheadend, does anyone know how generate a channel from this IPTV mux????

I never used IPTV mux yet. Is that necessary for the RTSP sink? I saw an RTSP-server project in gstreamer github.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Robert Mast over 7 years ago

Antonio S wrote:

Success,

It seems there are some RTSP-examples here, I don't now what they're worth though:

http://trac.gateworks.com/wiki/Yocto/gstreamer/streaming#rtsp

RE: TVHeadend Raspberry Pi and Transcoding - Added by Antonio S over 7 years ago

I have read somewhere else that http-proxy uses "multiple, unpredictable ports"
What does it means? It just start an http server on a well specified port, nothing more
Now: I'm not quite sure the goal we have here: of course one is to being able to transcode, but I assumed we wanted to get the transcoded stream back into tvheaded via pipe, to play it as a normal "channel".
But maybe it's just my goal ;)

RE: TVHeadend Raspberry Pi and Transcoding - Added by Morten Gade Sørensen over 7 years ago

Antonio S wrote:

Now: I'm not quite sure the goal we have here: of course one is to being able to transcode, but I assumed we wanted to get the transcoded stream back into tvheaded via pipe, to play it as a normal "channel".
But maybe it's just my goal ;)

I second that goal :) - It would be really great to have all this running inside tvheadend, in one way or the other!

I wish I could contribute, but I don't have the coding skills, so I just sit here an cheer :)

M

RE: TVHeadend Raspberry Pi and Transcoding - Added by Antonio S over 7 years ago

We are not coding, we are just using tools

RE: TVHeadend Raspberry Pi and Transcoding - Added by Gnag Flow over 7 years ago

Robert Mast wrote:

Gnag Flow wrote: ...

You should also disable h265, earlier in this thread I (among others) also formulated a compile statement for TVHeadend, including this. Furthermore, it seems your Makefile.ffmpeg is too old, while it points to a nonexistent repository (the 404). You should get a more recent TVHeadend source.

couldn't find the exact command to disable h265 in this thread earlier.
can you write it down for me?

and for tvheadend source i am using the source "deb https://dl.bintray.com/djbenson/deb wheezy unstable".
can you recommend another one?
i am using a raspberry pi 3 with raspbian jessie.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Alexander Meinke over 7 years ago

Hi Antonio,

nice to see you got a bit stuck (please, that's ironic ;)). Maybe I should have asked more precise, not just "Antonio, what would you do or plan next?".

The Answer could have been "make transcoding live with tvheadend streams". I would like to set the streaming profile in e.g. Kodi or the tvheadend iOS app, set the target connection to my internal dns or external ddns name of pi and watch, shift, record tv with epg and so on in a known environment.

Instead of using a STB with real and pseudo (only bitrate) hardware transcoding that offers possibilities like watching TV from everywhere through your own internet connection at home, we use pi + dvb-x USB adapter + cr. It could also be pc + dvb-x pci card + cr. I think the pi solution would be cheaper than a STB with hw trans. More flexible on new or defect hardware (tuner etc.).
I can see that some provider of internet access - whether cable, radio, dsl or fiber - are going to provide exactly that in one package. Watch tv via app on mobile or on huge, dominating resolution, curved, super flat screen through STB at home.

I think, if we want to get any further on this topic, there needs to be worked on ffmpeg or gstreamer. There is also work needed on the openmax implementation in raspbian. But requires a NDA with SoC manufacturer for video core reference.
So Antonio, if you like to code instead of using code/tools I would suggest that you spent time on ffmpeg or gstreamer. You seem to be not busy enough :-D.

I could need some help on the pipe:// url you mentioned in a earlier post. Is it possible to start a command like ffmpeg or gst-launch with that url? Or do I connect to the streaming url of tvheadend?

Stay tuned

RE: TVHeadend Raspberry Pi and Transcoding - Added by Robert Mast over 7 years ago

Antonio S wrote:

I have read somewhere else that http-proxy uses "multiple, unpredictable ports"
What does it means? It just start an http server on a well specified port, nothing more

I thought to have seen a different port number mentioned in the error following my attempt to use http-launch.
I'm not sure my router accepts those random ports, I often use 22 vpn-tunnels at home while straight communication on the LAN on other ports often goes in error. A vpn-tunnel via MobaXTerm doesn't support UDP though.

Now: I'm not quite sure the goal we have here: of course one is to being able to transcode, but I assumed we wanted to get the transcoded stream back into tvheaded via pipe, to play it as a normal "channel".
But maybe it's just my goal ;)

I already saw a pipe-example somewhere, if that's enough for TVHeadend to connect.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Robert Mast over 7 years ago

Gnag Flow wrote:

couldn't find the exact command to disable h265 in this thread earlier.

Sorry, it was x265, for example see page 5 of this thread.

and for tvheadend source i am using the source "deb https://dl.bintray.com/djbenson/deb wheezy unstable".
can you recommend another one?
i am using a raspberry pi 3 with raspbian jessie.

If you don't want to build you could use "deb https://dl.bintray.com/djbenson/deb jessie unstable"
that works for RPi2 and 3.

If you want to build (because the build available doesn't contain TVHeadend transcoding) you should teach yourself some git and fetch a more recent source from https://github.com/tvheadend/tvheadend

RE: TVHeadend Raspberry Pi and Transcoding - Added by First Last over 7 years ago

Gnag Flow, I had the EXACT same problem. Solution for me was to disable ffmpeg_static in the build (https://discourse.osmc.tv/t/unable-to-build-tvheadend-on-fresh-osmc-kodi17-install/22972).

I still can't find any muxes though, neither can w_scan :|.

Edit: I see now that that actually disables transcoding (whatever that is) and that is actually the subject of this topic. Sorry, I was just trying to help :).

RE: TVHeadend Raspberry Pi and Transcoding - Added by Bernard Konys over 7 years ago

I used to have a running gstreamer transcoding from tvheadend source and outputting to a particular port with the following:

gst-launch-1.0 souphttpsrc location= http://192.168.1.53:9981/stream/channelnumber/34 is-live=true ! tsdemux name=demux demux. ! queue ! h264parse ! queue ! omxh264dec ! videoscale method=3 ! video/x-raw,width=640,height=400 ! queue ! omxh264enc inline-header=true periodicty-idr=25 ! queue ! h264parse config-interval=1 ! queue ! mpegtsmux name=mux ! tcpserversink host=192.168.1.53 port=8554 demux. ! queue ! mpegaudioparse ! queue ! mux.

I have no notes of used versions, but will be trying to reproduce during upcoming weeks. Wouldn't the TCP server sink from gstreamer itself be enough for using pipe://?

Robert Mast wrote:

Antonio S wrote:

I have read somewhere else that http-proxy uses "multiple, unpredictable ports"
What does it means? It just start an http server on a well specified port, nothing more

I thought to have seen a different port number mentioned in the error following my attempt to use http-launch.
I'm not sure my router accepts those random ports, I often use 22 vpn-tunnels at home while straight communication on the LAN on other ports often goes in error. A vpn-tunnel via MobaXTerm doesn't support UDP though.

Now: I'm not quite sure the goal we have here: of course one is to being able to transcode, but I assumed we wanted to get the transcoded stream back into tvheaded via pipe, to play it as a normal "channel".
But maybe it's just my goal ;)

I already saw a pipe-example somewhere, if that's enough for TVHeadend to connect.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Andrei D over 7 years ago

Hello,

This is the command I use in IPTV Mux for hardware decoding/encoding :
pipe://ffmpeg -loglevel fatal -c:v mpeg2video -i http://127.0.0.1:9981/stream/channelnumber/19?profile=MPEG2 -vcodec h264_omx -preset ultrafast -s 1024x576 -r 29.97 -bf 2 -trellis 2 -b 3500k -bt 700k -acodec copy -metadata service_provider=Digi -metadata service_name=DigiSport2 -f mpegts -tune zerolatency pipe:1

I use a compiled FFmpeg with enabled h264_omx and mpeg2_mmal.I use just pipe://ffmpeg because pipe:///usr/bin/ffmpeg pints to another version of FFmpeg.So after creating an IPTV network,go to muxes,add mux,and at the url put the command.After that go back to Networks,select the IPTV network and force scan it.It will find one service that can be mapped.Do not map with the same number,or use another way to point to the channel(with ticket).Make sure that MPEG2 is alowed for 127.0.0.1 or use username and password.

PS:I use mpeg2video instead of mpeg2_mmal because of bad quality of mpeg2_mmal combined with h264_omx. Maybe someone could point for improvements.In this case the raspberry uses avarage 10% load.Or with htop ffmpeg process varies from 40-60-90% and all 4 cores working splitting that amount.If i use h_264_mmal and h264_omx the results are not that bad but for streaming to a big tv not recomended ,I will use it for mobile.In this case the rasbberry stays under 10%,or 5%.I am not sure that h264_omx supports that flags -preset -r -bf...,but if you don't use -s xxx x xxx it will look very bad.As for profile it won't matter if its pass or MPEG2,I created this for gstream. Sorry for bad language and if I mistaken something.

In the future maybe it will be a way to point tvheadend to use our ffmpeg build, not the static one.In that case we could use transcoding profiles.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Andrei D over 7 years ago

Can you please help me?I build tvheadend on raspberry with the built in ffmpeg and the shared one with enabled omx and mmla options.I can se tge h264_omx profile but the output video is green(i can see some pixels or something).I tried all tge presets and olso raspian and osmc.So the transcoding is working but video output is garbage.I fallowed this forum instructions.If I run outside tvheadened the output image is ok.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Jan Kowalski about 7 years ago

Hi,,

Anyone is able to change resolution or thick "deinterlace" when h264_omx is set to transcoding? When resolution is set to 0 and deinterlace is disabled, all working fine. But of I want to change resolution to for example 360, picture doesn't appear in "Watch TV".

RE: TVHeadend Raspberry Pi and Transcoding - Added by J N almost 7 years ago

Firstly, thanks to all your hard work on achiving transcoding on our rpi :)

To get compilation and installation work on my rpi3 with raspbian stretch i had to set "LIBRARY_PATH=/opt/vc/lib".
Without this, compilation failed because mmal and bcm libraries aren´t found by linker.
Strangely enough the command "ldconf -p" list all the needed libraries correctly.

My commands that i used:


export LIBRARY_PATH=/opt/vc/lib
make distclean
./configure --disable-libvpx --disable-libvpx_static --enable-mmal --enable-omx --enable-omx-rpi
make -j5
sudo LIBRARY_PATH=/opt/vc/lib make install

The last command needs "LIBRARY_PATH=/opt/vc/lib" in front of make, because with sudo the env isn´t available.

Greets

RE: TVHeadend Raspberry Pi and Transcoding - Added by Catscrash Catscrash over 6 years ago

Hi,

I used J N's commands as a basis and created a tvheadend package with:

LIBRARY_PATH=/opt/vc/lib AUTOBUILD_CONFIGURE_EXTRA="--disable-libvpx --disable-libvpx_static --enable-mmal --enable-omx --enable-omx-rpi" ./Autobuild.sh

the build process went fine, but when I start the new tvheadend version up, it looks like this:

https://pastebin.com/cWZZUjdZ

What went wrong? Any idea?

RE: TVHeadend Raspberry Pi and Transcoding - Added by Mark Clarkstone over 6 years ago

There are no crash lines, so there not a lot to be gleamed from that - looks like an abort.

RE: TVHeadend Raspberry Pi and Transcoding - Added by Alexander Meinke about 6 years ago

Hi,

I also managed to get transcoding for ts (mpeg2video, mpeg2audio) -> ts (h264, ac3) and ts (h264, ac3) -> ts (h264, ac3) working by using gstreamer.

SW:
Raspberry Pi reference 2018-06-27 image
tvheadend 4.3-1273~g610c6fa74~raspbianstretch
gstreamer1.0-omx-rpi-config 1.10.4-1+rpt3
gstreamer1.0-omx-rpi 1.10.4-1+rpt3

Then I added a new stream profile (Configuration -> Stream) from MPEG-TS Spawn/built-in template and the following command line:

CMD:
gst-launch-1.0 fdsrc fd=0 ! decodebin name=decoder decoder. ! queue ! avenc_ac3 ! mpegtsmux name=mux ! fdsink fd=1 decoder. ! omxh264enc ! mux.

This profile can then be used in playlist's url by adding ?profile=transcoding. For example:

http://raspberrypi.lan:9981/playlist/channels?profile=transcoding

That's all.

The pipeline could be tuned further, but therefore I need to investigate on gstreamer's pipeline. For example program information could be added to the stream. The decodebin is used to transcode any source transparently. The fdsrc and fdsink elements won't produce any overhead by walking the network stack as it would with sources like souphttpsrc.

One error that occur is by stopping the playback. It seem the write pipe (stdout) is closed before fully empty. The error in tvheadend log is:

Aug 09 11:54:26 raspberrypi tvheadend[13380]: spawn: ERROR: from element /GstPipeline:pipeline0/GstFdSink:fdsink0: Could not write to resource.
Aug 09 11:54:26 raspberrypi tvheadend[13380]: spawn: Additional debug info:
Aug 09 11:54:26 raspberrypi tvheadend[13380]: spawn: gstelements_private.c(317): gst_writev_buffers (): /GstPipeline:pipeline0/GstFdSink:fdsink0:
Aug 09 11:54:26 raspberrypi tvheadend[13380]: spawn: Error while writing to file descriptor 1: Broken pipe

Another error relates to decoding mpeg2 with mmal. The log says:

Aug 09 11:53:45 raspberrypi tvheadend[13380]: spawn: mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
Aug 09 11:53:45 raspberrypi tvheadend[13380]: spawn: mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x6a018650 (EINVAL)
Aug 09 11:53:45 raspberrypi tvheadend[13380]: spawn: mmal: mmal_port_disable: port vc.ril.video_decode:in:0(MP2V)(0x6a018650) is not enabled
Aug 09 11:53:45 raspberrypi tvheadend[13380]: spawn: mmal: mmal_port_disable: port vc.ril.video_decode:out:0(0x6a018970) is not enabled
Aug 09 11:53:45 raspberrypi tvheadend[13380]: spawn: mmal: mmal_port_disable: port vc.ril.video_decode:ctr:0(0x6a018340) is not enabled

Maybe someone with rpi's mpeg license active could test the pipeline.

Cheers

(126-150/160)