Project

General

Profile

How to make transcoding work?

Added by Joseph Black 10 months ago

Newbie here. Just setup tvheadend on Mint 21 (aka Ubuntu 22.04). Installed from mamarley ppa repo (details below).
Using hdhomerun flex duo.

Needless to say, the raw video uses waaaay too much bandwidth and disk space.
If there is ONLY ONE thing that anyone needs to get working, it is transcoding.
I've spent a day on it, and can't make it work.
All the information out there is sparse and vague.

Before getting into any details, can you clarify if transcoding works in the tvheadend app (not external scripts etc) in the following scenarios:
  • while pvr recording?
  • while live streaming?

Are there any instructions or tutorials?
I'm flailing around in the dark.

In the GUI, I went into "configuration/recording/digital video recorder profiles" and tried selecting different "stream profiles" such as "webtv-h264-aac-matroska". For each one, it records audio, but the video is blank.
I had a look at the syslog and it shows:

Dec 30 23:22:11 tvhtpc tvheadend[13927]: transcode: 0006: 01:MPEG2VIDEO: ==> Using profile webtv-h264
Dec 30 23:22:11 tvhtpc tvheadend[13927]: transcode: 0006: 02:AC3: ==> Using profile webtv-aac
Dec 30 23:22:11 tvhtpc tvheadend[13927]: transcode: 0006: 03:AC3: ==> Filtered out
Dec 30 23:22:11 tvhtpc tvheadend[13927]: transcode: 0006: 04:AC3: ==> Filtered out
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext: Error setting profile 0.
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext: Possible profiles:
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext:  baseline
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext:  main
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext:  high
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext:  high10
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext:  high422
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext:  high444
Dec 30 23:22:11 tvhtpc tvheadend[13927]: libav: AVCodecContext: 
Dec 30 23:22:16 tvhtpc tvheadend[13927]: dvr: /var/lib/tvheadend/recordings/Sometvprogram.mka from adapter: "HDHomeRun ATSC-T Tuner #0 (192.168.1.180)", network: "ATSC-T Network", mux: "177.028MHz", provider: "<N/A>", service: "WXYZ" 
Dec 30 23:22:16 tvhtpc tvheadend[13927]: dvr:  #  type              lang  resolution  aspect ratio  sample rate  channels
Dec 30 23:22:16 tvhtpc tvheadend[13927]: dvr:  1  H264                    1920x1080   16:9                                 <disabled, no valid input>
Dec 30 23:22:16 tvhtpc tvheadend[13927]: dvr:  2  AAC-LATM          eng                             48000        5.1 

This person posted the exact same problem ( link https://tvheadend.org/issues/6136) 2 years ago, with no answer.
Like them, I tried setting the profile (in the gui) to other values such as "main", and that gives the same error as above, except the error says "profile 77".

If it helps, this is the syslog info when the program starts:

Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: 'audio' context type registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHH264Decoder' decoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHTHEORADecoder' decoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHAACDecoder' decoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHVORBISDecoder' decoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHOPUSDecoder' decoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHMPEG2VIDEOEncoder' encoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHH264Encoder' encoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHHEVCEncoder' encoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: transcode: '&TVHAACEncoder' encoder helper registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'mpeg2video' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'mp2' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'aac' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'vorbis' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'flac' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libx264' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libx265' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libvpx' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libvpx-vp9' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libtheora' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libvorbis' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libfdk_aac' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'libopus' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'h264_vaapi' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'hevc_vaapi' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'vp8_vaapi' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'vp9_vaapi' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'h264_nvenc' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'hevc_nvenc' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'h264_omx' encoder registered
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'webtv-h264' codec profile created
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'webtv-aac' codec profile created
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'webtv-vp8' codec profile created
Dec 30 17:15:19 tvhtpc tvheadend[13927]: codec: 'webtv-vorbis' codec profile created

Here is the build info from the gui:

Configure arguments:
  --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode --disable-dependency-tracking --prefix=/usr --enable-hdhomerun_client --disable-hdhomerun_static --disable-dvbscan --enable-libav --disable-ffmpeg_static --enable-libx264 --disable-libx264_static --enable-libx265 --disable-libx265_static --enable-libvpx --disable-libvpx_static --enable-libtheora --disable-libtheora_static --enable-libvorbis --disable-libvorbis_static --enable-libfdkaac --disable-libfdkaac_static --enable-libopus --disable-libopus_static --enable-vaapi --enable-nvenc --enable-omx --enable-dvbcsa --enable-dvben50221 --enable-libsystemd_daemon --enable-pcre2 --enable-pngquant --enable-ddci --python=/usr/bin/python3

Compiler:
  Using C compiler:                        cc
  Using C flags:                           -g -O2 -ffile-prefix-map=/build/tvheadend-uC9S4H/tvheadend-4.3.0~pre+202312260827=. -flto=auto -ffat-lto-objects -flto=auto -ffat-lto-objects -fstack-protector-strong -Wformat -Werror=format-security
  Using LD flags:                          -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -Wl,-z,now -lhdhomerun -ldvbcsa
  Build for arch:                          x86_64

Binaries:
  Using PYTHON:                            /usr/bin/python3
  Using GZIP:                              gzip
  Using BZIP2:                             bzip2

Options:
  pie                                      yes
  ccdebug                                  no
  cardclient                               yes
  cwc                                      yes
  cccam                                    yes
  capmt                                    yes
  constcw                                  yes
  linuxdvb                                 yes
  satip_server                             yes
  satip_client                             yes
  hdhomerun_client                         yes
  hdhomerun_server                         yes
  hdhomerun_static                         no
  iptv                                     yes
  tsfile                                   yes
  dvbscan                                  no
  timeshift                                yes
  trace                                    yes
  avahi                                    yes
  zlib                                     yes
  libav                                    yes
  ffmpeg_static                            no
  libx264                                  yes
  libx264_static                           no
  libx265                                  yes
  libx265_static                           no
  libvpx                                   yes
  libvpx_static                            no
  libtheora                                yes
  libtheora_static                         no
  libvorbis                                yes
  libvorbis_static                         no
  libfdkaac                                yes
  libfdkaac_static                         no
  libopus                                  yes
  libopus_static                           no
  nvenc                                    yes
  vaapi                                    yes
  mmal                                     no
  omx                                      yes
  inotify                                  yes
  epoll                                    yes
  pcre                                     no
  pcre2                                    yes
  uriparser                                yes
  ccache                                   no
  tvhcsa                                   yes
  bundle                                   no
  pngquant                                 yes
  kqueue                                   no
  dbus_1                                   yes
  android                                  no
  gtimer_check                             no
  slow_memoryinfo                          no
  libsystemd_daemon                        yes
  pcloud_cache                             yes
  ddci                                     yes
  cclang_threadsan                         no
  gperftools                               no
  execinfo                                 yes
  mmx                                      yes
  sse2                                     yes
  W_unused_result                          yes
  f_stack_protector                        yes
  f_stack_protector_strong                 yes
  f_stack_check                            yes
  f_PIE                                    yes
  fdatasync                                yes
  getloadavg                               yes
  atomic32                                 yes
  atomic64                                 yes
  atomic_time_t                            yes
  atomic_ptr                               yes
  bitops64                                 yes
  lockowner                                yes
  qsort_r                                  yes
  time_ld                                  yes
  gmtoff                                   yes
  recvmmsg                                 yes
  sendmmsg                                 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
  linuxdvb_ca                              yes
  libhdhomerun                             yes
  upnp                                     yes
  hwaccels                                 yes
  inotify_h                                yes
  inotify_init1                            yes
  dvbcsa                                   yes
  epoll_create1                            yes
  mpegts                                   yes
  mpegts_dvb                               yes

Packages:
  openssl                                  3.0.2
  zlib                                     1.2.11
  libpcre2-8                               10.39
  liburiparser                             0.9.6
  avahi-client                             0.8
  libavfilter                              7.110.100
  libswresample                            3.9.100
  libswscale                               5.9.100
  libavformat                              58.76.100
  libavcodec                               58.134.100
  libavutil                                56.70.100
  libva                                    1.14.0
  libva-drm                                1.14.0
  dbus-1                                   1.12.20
  libsystemd                               249

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

Sigh, if I wanted to watch straight ATSC signal, I would have just connected the antenna to the TV, and not purchased a PC, Hdhomerun, network equipment, and spent a day setting up tvheadend. The ONLY reason for all of this is to transcode and store/stream the video efficiently.


Replies (2)

RE: How to make transcoding work? - Added by Ukn Unknown 10 months ago

I can confirm that I am using HW transcoding VAAPI using iGPU (Intel) for live transcoding. I tested also SW transcoding (resized to 384). My tuner is USB.
My recommendation is to try to compile your own deb (from Master) ... in order to get support.
Is not clear when mmarley spined off from Master ... bellow is my configure results.
My codec has the following settings and is able to transcode H264 HD and MPEG SD to h264 (libx264).
SW transcoding (decode + encode) is very CPU intensive ... what CPU and RAM speed you have?

Configure arguments:
  --build=x86_64-linux-gnu --prefix=/usr --includedir=${prefix}/include --mandir=${prefix}/share/man --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --disable-option-checking --disable-silent-rules --libexecdir=${prefix}/lib/tvheadend --disable-maintainer-mode --disable-dependency-tracking --arch=x86_64

Compiler:
  Using C compiler:                        cc
  Using LD flags:                           -ldvbcsa
  Build for arch:                          x86_64

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

Options:
  pie                                      yes
  ccdebug                                  no
  cardclient                               yes
  cwc                                      yes
  cccam                                    yes
  capmt                                    yes
  constcw                                  yes
  linuxdvb                                 yes
  satip_server                             yes
  satip_client                             yes
  hdhomerun_client                         yes
  hdhomerun_server                         yes
  hdhomerun_static                         yes
  iptv                                     yes
  tsfile                                   yes
  dvbscan                                  yes
  timeshift                                yes
  trace                                    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                                no
  libfdkaac_static                         no
  libopus                                  yes
  libopus_static                           yes
  nvenc                                    no
  vaapi                                    yes
  mmal                                     no
  omx                                      no
  inotify                                  yes
  epoll                                    yes
  pcre                                     no
  pcre2                                    yes
  uriparser                                yes
  ccache                                   no
  tvhcsa                                   yes
  bundle                                   no
  pngquant                                 no
  kqueue                                   no
  dbus_1                                   yes
  android                                  no
  gtimer_check                             no
  slow_memoryinfo                          no
  libsystemd_daemon                        no
  pcloud_cache                             yes
  ddci                                     yes
  cclang_threadsan                         no
  gperftools                               no
  execinfo                                 yes
  mmx                                      yes
  sse2                                     yes
  W_unused_result                          yes
  f_stack_protector                        yes
  f_stack_protector_strong                 yes
  f_stack_check                            yes
  f_PIE                                    yes
  fdatasync                                yes
  getloadavg                               yes
  atomic32                                 yes
  atomic64                                 yes
  atomic_time_t                            yes
  atomic_ptr                               yes
  bitops64                                 yes
  lockowner                                yes
  qsort_r                                  yes
  time_ld                                  yes
  gmtoff                                   yes
  recvmmsg                                 yes
  sendmmsg                                 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
  linuxdvb_ca                              yes
  upnp                                     yes
  bin_cmake                                yes
  stdcpp                                   yes
  libogg_static                            yes
  hwaccels                                 yes
  inotify_h                                yes
  inotify_init1                            yes
  dvbcsa                                   yes
  epoll_create1                            yes
  mpegts                                   yes
  mpegts_dvb                               yes

Packages:
  openssl                                  3.0.2
  zlib                                     1.2.11
  libpcre2-8                               10.39
  liburiparser                             0.9.6
  avahi-client                             0.8
  libva                                    1.18.0
  libva-drm                                1.18.0
  dbus-1                                   1.12.20

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

codec.png (62.3 KB) codec.png

RE: How to make transcoding work? - Added by Joseph Black 10 months ago

Ukn Unknown wrote:

I can confirm that I am using HW transcoding VAAPI using iGPU (Intel) for live transcoding. I tested also SW transcoding (resized to 384). My tuner is USB.
My recommendation is to try to compile your own deb (from Master) ... in order to get support.
Is not clear when mmarley spined off from Master ... bellow is my configure results.
My codec has the following settings and is able to transcode H264 HD and MPEG SD to h264 (libx264).
SW transcoding (decode + encode) is very CPU intensive ... what CPU and RAM speed you have?

[...]

Thanks for replying.

Ugggh, this is a long story, but in the end I got it working.

This all started long ago (and on a planet far far away) when I was trying to follow the ubuntu install instructions.
I was expecting that the ubuntu ppa instructions would be like every other ppa instructions, and would say something like "add this ppa".
Instead, it doesn't say that. At the top (for the offical package) it has a header labelled "setup" with a wget instruction to download and run some bash script.
Ugggh, no explicit instructions on what to do, and some command to download and run some sketchy bash script as sudo. Might as well walk across a minefield ;-)
So I downloaded the script, inspected it, ran it, and crossed my fingers.
After that, tried an "apt update" and it just errored out.
I had enough of that.

I moved on to the the below section labelled "ubuntu ppa" where the mamarley stuff is.
Ok, this is looking more familiar, as it instructs to add the ppa.
Tried to "stable" ppa and...bzzzzt.. it doesn't exist!
We're 2 for 3 on these instructions now.
Moved on to the last chance, and tried to install the unstable mamarley.
Success, it installed.

Then I ended up with software where transcoding does not work, and had to make the above post.

So then I tried as you suggested, and tried to compile myself.
Since I was having such bad luck, I decided to do it on a VM (because I sorta knew I'd be doing this over and over).
I ended up getting it compiled, however when it ran, it would just crash.
Spent hours on that with no success.

With all options exhausted, I decided to go back and take another look at the very first install method (the official package that has you run some bash file).
I had a look at what it was doing, and found that it was generating a ppa file (in /etc/apt/sources.list.d) with completely wrong information.
It was populating the file with info from my linux mint install (I forget, it was stuff like "vanessa", etc).
So I just manually edited the file, and changed that linux mint info to ubuntu info (ubuntu/jammy).
I then got apt to work, and it could now find the repo.
Uggghh, like I said at the top, why not just have ppa instructions like everywhere else, instead of a bash file that generates wrong info.

Ok, so I'm still doing this on a VM. After I installed the official package from the repo, the software ran and crashed (just like the compiled version).
Can't catch a break!

So with nowhere to go, for the heck of it, I installed the one know working version on the VM (the mamarley unstable).
It too crashed!
So I figured, maybe all this crashing is just because it is running on a VM, and with any luck, there's nothing wrong with the compiled versions or the official package if I run them on a HW machine.

So I installed the official package on a HW machine (now that I know how to fix the install) and it ran AND transcoding works.

So I got to my destination through the longest possible path.

Hopefully there is some info above to shorten the path for others:
  • mamarley stable doesn't exist
  • mamarley unstable doesn't transcode
  • for the official package, run the bash script and then check your /etc/apt/sources.list.d file to make sure it has the right info in it
  • for some reason, all versions crash on a vm

Not sure what's up with running on a VM. I was using Virtualbox. I tried enabling every kind of "hardware" feature (pae, vts, graphics 3d accel).

    (1-2/2)