This is why mythtranscode - HTTP Live streaming (HLS) is broken

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
BigEd
Newcomer
Posts: 11
Joined: Wed Oct 25, 2023 8:59 am
Canada

This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by BigEd »

Firstly, I want to thank everyone who has contributed, regardless of the size, to make MythTV the DVR I love so much and continue to use since 2010.
Secondly, I want to open a ticket for this issue so that it can be fixed so if anyone reading this can point me in the right direction, I will appreciate that.
Nonetheless, I'm currently running the latest stable MythTV 33.1+fixes.202309262218.26e76a3949~ubuntu22.04.1 on Xubuntu Jammy (22.04) LTS, installed from the Mythbuntu Team PPA. Below are details of my system:

Code: Select all

ed@mythtv-master:~$ inxi -GxxS
System:
  Host: mythtv-master Kernel: 5.15.0-87-generic arch: x86_64 bits: 64
    compiler: gcc v: 11.4.0 Desktop: Xfce v: 4.18.1 tk: Gtk v: 3.24.33 wm: xfwm
    dm: LightDM Distro: Ubuntu 22.04.3 LTS (Jammy Jellyfish)
Graphics:
  Device-1: Intel Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics
    vendor: ASUSTeK driver: i915 v: kernel arch: Gen-7.5 ports: active: HDMI-A-2
    empty: HDMI-A-1,VGA-1 bus-ID: 00:02.0 chip-ID: 8086:0412
  Display: x11 server: XOrg v: 1.21.1.4 with: Xwayland v: 22.1.1
    compositor: xfwm v: 4.18.0 driver: X: loaded: modesetting
    unloaded: fbdev,vesa dri: crocus gpu: i915 display-ID: :0.0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96
  Monitor-1: HDMI-A-2 mapped: HDMI-2 model: LG (GoldStar) TV res: 1920x1080
    dpi: 305 diag: 184mm (7.2")
  API: OpenGL v: 4.6 Mesa 23.3~git2310240600.9de455~oibaf~j (git-9de455b
    2023-10-24 jammy-oibaf-ppa) renderer: Mesa Intel HD Graphics 4600 (HSW
    GT2) compat-v: 4.6 direct-render: Yes
I have searched through this forum, combed through the net, google, etc and have found several users experiencing this same issue with MythTV HLS not working without a solution. As my way of contributing, I have spent sometime to troubleshoot and investigate why MythTV HLS isn't working anymore. Below are my findings.

I searched the build logs on launchpadlibrarian to confirm that the deb packages which were used to install my MythTV was compiled and built with the --enable-libmp3lame --enable-libx264 options which are required by HLS, according to the documentation on the wiki. I don't want to commit any infractions but if permitted, I can provide the launchpadlibrarian URL for anybody who wants to know and check for themselves. Or, if you use Ubuntu and installed MythTV from the Mythbuntu Team PPA, you can find a link to the build logs there.

Next, I checked mythtranscode and mythbackend versions on my system to verify that they were using the libx264 and libmp3lame options/codecs. Unfortunately, they are not using the libx264 option/codec.

Code: Select all

root@mythtv-master:~# mythbackend --version | grep -i libx264
root@mythtv-master:~# mythbackend --version | grep 264
root@mythtv-master:~# mythtranscode --version | grep -i 264
root@mythtv-master:~# mythbackend --version | grep -i mp3
 linux profile use_hidesyms using_alsa using_oss using_pulse using_pulseoutput using_backend using_bindings_perl using_bindings_python using_bindings_php using_dvb using_firewire using_frontend using_hdhomerun using_satip using_vbox using_ceton using_joystick_menu using_libcec using_libcrypto using_gnutls using_libdns_sd using_libxml2 using_lirc using_mheg using_opengl using_egl using_qtwebkit using_qtscript using_qtdbus using_taglib using_v4l2 using_v4l2prime using_x11 using_system_libbluray using_system_libudfread using_systemd_notify using_systemd_journal using_drm using_bindings_perl using_bindings_python using_bindings_php using_freetype2 using_mythtranscode using_opengl using_egl using_drm using_vaapi using_nvdec using_vdpau using_ffmpeg_threads using_mheg using_libass using_libxml2 using_libmp3lame
I confirmed that I have installed all the required libraries and dependencies.

Code: Select all

root@mythtv-master:~# dpkg -l | grep -i libx264
ii  libx264-163:amd64                     2:0.163.3060+git5db6aa6-2build1                    amd64        x264 video coding library
ii  libx264-164:amd64                     2:0.164.3153+git5f84d40-0ubuntu1~22.04.sav0        amd64        x264 video coding library
ii  libx264-dev:amd64                     2:0.164.3153+git5f84d40-0ubuntu1~22.04.sav0        amd64        development files for libx264

root@mythtv-master:~# dpkg -l | grep -i libmp3lame
ii  libmp3lame0:amd64                     3.100-4~22.04.sav1                                 amd64        MP3 encoding library

root@mythtv-master:~# dpkg -l | grep -i ffmpeg
ii  chromium-codecs-ffmpeg-extra          1:118.0.5993.88-0ubuntu0.22.04.1sav0               amd64        Extra ffmpeg codecs for the Chromium Browser
ii  ffmpeg                                7:6.0+git20231012~ubuntu22.04.1                    amd64        Tools for transcoding, streaming and playing of multimedia files
ii  gstreamer1.0-libav:amd64              1.20.6-0ubuntu1~22.04.sav0                         amd64        ffmpeg plugin for GStreamer
ii  libavcodec58:amd64                    7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library with de/encoders for audio/video codecs - runtime files
ii  libavdevice58:amd64                   7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library for handling input and output devices - runtime files
ii  libavfilter7:amd64                    7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library containing media filters - runtime files
ii  libavfilter9:amd64                    7:6.0-1build8~22.04                                amd64        FFmpeg filter library
ii  libavformat58:amd64                   7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library with (de)muxers for multimedia containers - runtime files
ii  libavformat60:amd64                   7:6.0-1build8~22.04                                amd64        FFmpeg file format library
ii  libavutil56:amd64                     7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library with functions for simplifying programming - runtime files
ii  libavutil58:amd64                     7:6.0-1build8~22.04                                amd64        FFmpeg avutil library - runtime files
ii  libpostproc55:amd64                   7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library for post processing - runtime files
ii  libswresample3:amd64                  7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii  libswresample4:amd64                  7:6.0-1build8~22.04                                amd64        FFmpeg library for audio resampling, rematrixing etc. - runtime files
ii  libswscale5:amd64                     7:4.4.4-0ubuntu1~22.04.sav1.1                      amd64        FFmpeg library for image scaling and various conversions - runtime files
ii  libswscale7:amd64                     7:6.0-1build8~22.04                                amd64        FFmpeg library for image scaling and various conversions - runtime files
I confirmed that the ffmpeg version installed on my system has the --enable-libx264 and --enable-libmp3lame options.

Code: Select all

root@mythtv-master:~# ffmpeg --version | grep -i 264
ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/opt/ffmpeg --arch=amd64 --disable-debug --disable-htmlpages --enable-nonfree --enable-gpl --enable-version3 --enable-avisynth --enable-ffnvcodec --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libdc1394 --enable-libdrm --enable-libfdk-aac --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo_amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-nvdec --enable-nvenc --enable-openal --enable-opengl --enable-vaapi --enable-vdpau
So, now, when I open Webfrontend in a browser, navigate to TV, Recordings, click "Watch" for any recorded TV show, "Play in Browser", it triggers mythtranscode to generate HTTP Live Stream output. However, it fails with 2 "Unknown audio decoding error" and multiple "video encode error: Invalid argument (0)". Below is the mythtranscode log. Please note that the TV recordings I'm using for this troubleshooting are using mpeg-2 video compression, thus, mpeg2video codec with ac3 audio, not h264 codec, so this should work as before according to the Mythtranscode documentation on the wiki, but it doesn't.

Code: Select all

root@mythtv-master:~# tail -f -n 15 /var/log/mythtv/mythtranscode.log 

Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: C thread_unknown mythcommandlineparser.cpp:2903 (ConfigureLogging) mythtranscode version: fixes/33 [v33.1+fixes.202309262218.26e76a3949~ubuntu22.04.1] www.mythtv
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: C thread_unknown mythcommandlineparser.cpp:2907 (ConfigureLogging) Qt version: compile: 5.15.3, runtime: 5.15.3
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown mythcommandlineparser.cpp:2909 (ConfigureLogging) Ubuntu 22.04.3 LTS (x86_64)
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: N thread_unknown mythcommandlineparser.cpp:2911 (ConfigureLogging) Enabled verbose msgs:  general
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: N thread_unknown logging.cpp:689 (logStart) Setting Log Level to LOG_INFO
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I Logger logging.cpp:277 (run) Added logging to the console
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I LogForward loggingserver.cpp:219 (SyslogLogger) Added syslogging
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Interrupt handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Terminated handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Segmentation fault handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Aborted handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Floating point exception handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Illegal instruction handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Bus error handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Real-time signal 0 handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I thread_unknown signalhandling.cpp:182 (SetHandlerPrivate) Setup Hangup handler
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: N thread_unknown mythdirs.cpp:203 (InitializeMythDirs) Using runtime prefix = /usr
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: N thread_unknown mythdirs.cpp:204 (InitializeMythDirs) Using configuration directory = /home/mythtv/.mythtv
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcorecontext.cpp:261 (Init) Assumed character encoding: en_CA.UTF-8
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcontext.cpp:584 (LoadDatabaseSettings) Empty LocalHostName. This is typical.
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcontext.cpp:635 (LoadDatabaseSettings) Using a profile name of: 'mythtv-master' (Usually the same as this host's name.)
Oct 24 17:54:21 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcontext.cpp:872 (TestDBconnection) Start up testing connections. DB localhost, BE , attempt 0, status dbAwake, Delay: 2000
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext mythcorecontext.cpp:1826 (InitLocale) Setting QT default locale to en_US
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcorecontext.cpp:1859 (SaveLocaleDefaults) Current locale en_US
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext mythlocale.cpp:120 (LoadDefaultsFromXML) Reading locale defaults from /usr/share/mythtv//locales/en_us.xml
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythpowerdbus.cpp:540 (AcquireLock) PowerDBus: Failed to delay sleep,shutdown: Permission denied
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythpower.cpp:354 (PowerLevelChanged) Power: On AC power
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythpower.cpp:136 (Init) Power: Supported actions: None
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythtranslation.cpp:62 (load) Loading en_ca translation for module mythfrontend
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcorecontext.cpp:460 (ConnectCommandSocket) MythCoreContext::ConnectCommandSocket(): Connecting to backend server: localhost:6543 (try 1 of 60)
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcorecontext.cpp:1708 (CheckProtoVersion) MythCoreContext::CheckProtoVersion(): Using protocol version 91 BuzzOff
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext mythtranscode.cpp:556 (main) Transcoding HTTP Live Stream ID 60
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: W CoreContext mythtranscodeplayer.cpp:19 (SetTranscoding) TranscodePlayer: No decoder yet - cannot set transcoding
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythplayer.cpp:430 (OpenFile) Player(0): Opening '/media/disk6/TVshows/1291_20161125073000.mpg'
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythvideoprofile.cpp:1325 (InitStatics) VideoProfile: No window!
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext avformatdecoder.cpp:2029 (ScanStreams) AFD: codec ac3 has 6 channels
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext avformatdecoder.cpp:2508 (OpenAVCodec) AFD: Opened codec 0x563e3b50d940, id(ac3) type(Audio)
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext avformatdecoder.cpp:2029 (ScanStreams) AFD: codec ac3 has 2 channels
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext avformatdecoder.cpp:2508 (OpenAVCodec) AFD: Opened codec 0x563e3b50cfc0, id(ac3) type(Audio)
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext avformatdecoder.cpp:2427 (ScanStreams) AFD: Using ffmpeg for video decoding
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext avformatdecoder.cpp:2508 (OpenAVCodec) AFD: Opened codec 0x563e3b506d40, id(mpeg2video) type(Video)
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext audioplayer.cpp:158 (ReinitAudio) AudioPlayer: Enabling Audio
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext transcode.cpp:472 (TranscodeFile) HLS: Using segment size of 4 seconds
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext transcode.cpp:546 (TranscodeFile) x264 HLS using: 2 threads, 'veryfast' profile and 'film' tune
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythvideoout.cpp:175 (SetDeinterlacing) VideoOutput: SetDeinterlacing (Doublerate 0): Single Medium|CPU Double None
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1022 (TranscodeFile) Transcoding for HTTP Live Streaming
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I VideoDecodeBuffer avformatdecoder.cpp:4674 (ProcessAudioPacket) AFD: Audio stream changed
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I VideoDecodeBuffer avformatdecoder.cpp:4677 (ProcessAudioPacket) AFD: Number of audio channels changed from 2 to 6
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: E VideoDecodeBuffer avformatdecoder.cpp:4725 (ProcessAudioPacket) AFD: Unknown audio decoding error
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I VideoDecodeBuffer avformatdecoder.cpp:4674 (ProcessAudioPacket) AFD: Audio stream changed
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I VideoDecodeBuffer avformatdecoder.cpp:4677 (ProcessAudioPacket) AFD: Number of audio channels changed from 2 to 6
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 0% Completed @ 0 fps.
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:42 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 15% Completed @ 843.183 fps.
Oct 24 17:54:42 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:46 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:47 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:48 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:54:49 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:01 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:02 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 30% Completed @ 833.704 fps.
Oct 24 17:55:02 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:12 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:12 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:13 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:14 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:17 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:17 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:19 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:19 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:19 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 46% Completed @ 836.113 fps.
Oct 24 17:55:22 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:42 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 62% Completed @ 841.778 fps.
Oct 24 17:55:42 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:46 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:47 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:49 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:55:49 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:02 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 77% Completed @ 837.53 fps.
Oct 24 17:56:02 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:03 mythtv-master mythtranscode: mythtranscode[1378640]: E VideoDecodeBuffer avformatdecoder.cpp:4725 (ProcessAudioPacket) AFD: Unknown audio decoding error
Oct 24 17:56:03 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:17 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:17 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:18 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:19 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1523 (TranscodeFile) mythtranscode: 94% Completed @ 846.749 fps.
Oct 24 17:56:22 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:29 mythtv-master mythtranscode: mythtranscode[1378640]: E VideoDecodeBuffer avformatdecoder.cpp:4897 (GetFrame) decoding error End of file (-541478725)
Oct 24 17:56:29 mythtv-master mythtranscode: mythtranscode[1378640]: E CoreContext mythavformatwriter.cpp:243 (WriteVideoFrame) AVFW(/var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts): video encode error: Invalid argument (0)
Oct 24 17:56:29 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext mythtranscode.cpp:715 (main) Transcoding  done
Oct 24 17:56:29 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythpowerdbus.cpp:73 (~MythPowerDBus) PowerDBus: Closing interfaces
Oct 24 17:56:29 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcontext.cpp:1678 (~MythContext) Waiting for threads to exit.
Oct 24 17:56:30 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythcontext.cpp:1684 (~MythContext) Exiting
The generated video transport stream files are 0 bytes in size.

Code: Select all

root@mythtv-master:~# ll -h /var/lib/mythtv/streaming/
total 24K
drwxrwsr-x  2 mythtv mythtv 4.0K Oct 24 17:56 ./
drwxrwsr-x 13 mythtv mythtv 4.0K Sep 10 02:03 ../
-rw-r--r--  1 mythtv mythtv    0 Oct 24 17:54 1291_20161125073000.mpg.640x368_600kV_64kA.ao_64kA.000001.ts
-rw-r--r--  1 mythtv mythtv  166 Oct 24 17:56 1291_20161125073000.mpg.640x368_600kV_64kA.ao_64kA.m3u8
-rw-r--r--  1 mythtv mythtv    0 Oct 24 17:54 1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts
-rw-r--r--  1 mythtv mythtv  161 Oct 24 17:56 1291_20161125073000.mpg.640x368_600kV_64kA.av.m3u8
-rw-r--r--  1 mythtv mythtv  289 Oct 24 17:54 1291_20161125073000.mpg.640x368_600kV_64kA.html
-rw-r--r--  1 mythtv mythtv  469 Oct 24 17:54 1291_20161125073000.mpg.640x368_600kV_64kA.m3u8
Even though mythtranscode executed the process, the JW Player has an empty video file to play because of the audio and video encode errors mythtranscode ran into. I copied the JW Player over from my old Mythbuntu Xenial (16.04) LTS installation.

Code: Select all

root@mythtv-master:~# ll -h /home/mythtv/.mythtv/3rdParty/JW_Player/
total 784K
drwxr-xr-x 2 mythtv mythtv 4.0K Sep  9 20:44  ./
drwxr-xr-x 3 mythtv mythtv 4.0K Sep  9 20:44  ../
-rw-r--r-- 1 mythtv mythtv  14K Sep  9 20:44  adaptiveProvider.swf
-rw-r--r-- 1 mythtv mythtv 137K Sep  9 20:44  jwplayer.js
-rw-r--r-- 1 mythtv mythtv 277K Sep  9 20:44 'JW Player Quick Start Guide.pdf'
-rw-r--r-- 1 mythtv mythtv  625 Sep  9 20:44  license.txt
-rw-r--r-- 1 mythtv mythtv 105K Sep  9 20:44  player.swf
-rw-r--r-- 1 mythtv mythtv 8.2K Sep  9 20:44  preview.jpg
-rw-r--r-- 1 mythtv mythtv 5.7K Sep  9 20:44  readme.html
-rw-r--r-- 1 mythtv mythtv  667 Sep  9 20:44  readme.mythtv
-rw-r--r-- 1 mythtv mythtv 6.8K Sep  9 20:44  swfobject.js
-rw-r--r-- 1 mythtv mythtv 195K Sep  9 20:44  video.mp4
This is what we end up looking at. Even though MythTV was compiled and built with the --enable-libmp3lame --enable-libx264 options which are required by HLS, for whatever reason, mythbackend and mythtranscode versions do not show using_libx264. I don't know if this is what is causing the issue but the following lines from the mythtranscode log give clues or hints.

Code: Select all

Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext transcode.cpp:472 (TranscodeFile) HLS: Using segment size of 4 seconds
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: N CoreContext transcode.cpp:546 (TranscodeFile) x264 HLS using: 2 threads, 'veryfast' profile and 'film' tune
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext mythvideoout.cpp:175 (SetDeinterlacing) VideoOutput: SetDeinterlacing (Doublerate 0): Single Medium|CPU Double None
Oct 24 17:54:22 mythtv-master mythtranscode: mythtranscode[1378640]: I CoreContext transcode.cpp:1022 (TranscodeFile) Transcoding for HTTP Live Streaming
The mythbackend logs reveals the command which was executed yesterday when I was troubleshooting the issue, below:

Code: Select all

root@mythtv-master:~# grep -i mythtranscode /var/log/mythtv/mythbackend.log 
Oct 23 04:53:59 mythtv-master mythbackend: mythbackend[3477]: W HTTPLiveStream httplivestream.cpp:86 (run) HLS(): Command '/usr/bin/mythtranscode --hls --hlsstreamid 57 --verbose general --loglevel info --quiet --syslog local7' returned 139
Running this command reveals that the recorded file with the HLS stream ID in the option, --hlsstreamid 57, can't be found as I deleted that specific recording file unknowingly by expiring some live TV recordings and others. That's a different unrelated topic. Back to the subject at hand, the mythbackend logs doesn't show the command which get executed if or when I repeat the "Play in Browser" steps now to recreate the issue. However, running the following mythtranscode command with the --hls option in the terminal produces the exact same results I have created this post about:

Code: Select all

ed@mythtv-master:~$ mythtranscode -i /media/disk6/TVshows/1291_20161125073000.mpg --hls --height 368 --width 640 --maxsegments 4 -e ts -p veryfast --loglevel debug --showprogress -v -o /var/lib/mythtv/streaming/1291_20161125073000.mpg.640x368_600kV_64kA.av.000001.ts
Sorry for such a long post. Hopefully it helps to get to the bottom of fixing this issue.

Thank you.
BigEd
Newcomer
Posts: 11
Joined: Wed Oct 25, 2023 8:59 am
Canada

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by BigEd »

See attached screenshots.
User avatar
Steve Goodey
Moderator
Posts: 216
Joined: Fri Feb 07, 2014 6:30 pm
Location: Colchester, England
Great Britain

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by Steve Goodey »

You might find that attachments are not allowed until you have done further posts.
Don't forget the Wiki.
User avatar
pgbennett
Developer
Posts: 495
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by pgbennett »

I believe mythtranscode is broken, at least for some cases.
My workaround for watching shows form a browser is as follows. Install the latest master V34-pre version of mythtv. This has the new web app which replaces the one you are using on V33.
Install vlc on your computer.
In the new web app, you can navigate to a list of recordings as well as to a list of videos. In both of these lists there is a file download icon at the end of each row. Right click the icon and copy link address. This copies a string that looks like this

Code: Select all

http://rocinante:6544/Content/GetRecording?RecordedId=13
Run vlc with the llink address as a parameter, in quotes:

Code: Select all

vlc "http://rocinante:6544/Content/GetRecording?RecordedId=13"
The recording plays on your computer in the vlc window. The file is not downloaded to your computer, vlc plays it directly from the link.
This is not ideal. Depending on your needs it may work for you.
BigEd
Newcomer
Posts: 11
Joined: Wed Oct 25, 2023 8:59 am
Canada

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by BigEd »

Thank you pgbennett. Currently on MythTV 33.1, I can watch recorded TV shows with VLC from mythweb and the old Webfrontend on port 6544. I was hoping this HTTP Live Streaming issue could be fixed as it is a neat feature to have if you want to remotely connect and watch recorded shows without using a lot of bandwidth. I know it's doable and I'm willing to volunteer to see how I can help get it working again.

I also see the new Webfrontend/web app on port 6744 and it looks uncompleted on MythTV 33.1. I'm waiting for MythTV 34 to be officially released so I can play with all the new features like configuring and tuning the backend on the web app.
User avatar
pgbennett
Developer
Posts: 495
Joined: Mon Apr 27, 2015 5:41 pm
United States of America

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by pgbennett »

Last time I looked at it, mythtranscode seemed to only transcode to mpeg-4 part 2 (H263), which is obsolete now and devices like android TV, and fire stick do not support it. These days H264 or H265 are the standard for streaming. There is a small set of formats that will play on a browser without requiring a plugin.

If you want to fix mythtranscode so that it works in a format supported by HTML I will add a player to the new web app.

I think it would be better to run a utility such as ffmpeg to transcode. MythTV uses the ffmpeg API, which is very complex and subject to periodic changes. This contributes to the problems in mythtranscode.
BigEd
Newcomer
Posts: 11
Joined: Wed Oct 25, 2023 8:59 am
Canada

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by BigEd »

I have used the MythTV HLS feature a lot and I'm very sure mythtranscode supported mpeg4-part 10 (H264). Even the MythTV documentation for HLS has a pre-requisite for H.264 and Mp3:

https://www.mythtv.org/wiki/HTTP_Live_Streaming_Server

I still have Mythbuntu Precise (12.04) and Xenial (16.04) archived in storage. I can roll them out, test and confirm if necessary.
white_haired_uncle
Senior
Posts: 211
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by white_haired_uncle »

I've used mythtranscode (GUI) for many years, and I've only seen MPEG2/4 target[1]. Every time I've tried it over the last few years at least, 4 was borked (no video IIRC), but I still use 2 pretty much daily ("lossless" MPEG2>MPEG2, though the option was removed from the GUI it's still in mysql).

I keep hoping someone else will add AV1 support, greater than 720x480 (when not using lossless), and maybe some other bells and whistles.

Even though I use handbrake to convert to AV1 for long term storage, I still rely on mythtranscode to honor the cutlist first. Wish I could do both in one step.
I've seen some example scripts that (try?) to use the cutlist, but they all have one thing or another I don't like (one is having to query/update mythconverg, if I ever get around to looking at the API stuff I'll have to check if you can do that).

[1] For MPEG2 source. Not a clue what this rtjpeg thing is.

EDIT: Looks like (non-lossless) transcode MIGHT still be busted in 34. I was checking out the (mostly awesome) new web stuff and accidentally launched a transcode (was hoping it was going to ask which profile to use, it just picked (the first?) one). But that was .nuv to .nuv (14 year old recording, probably back in the PVR days), not sure what the codec was (nuv was the container, right?).
User avatar
paulh
Developer
Posts: 905
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by paulh »

@BigEd thanks for looking at this.

Not sure we have any dev left with the required expertise to fix the HLS stuff so any help to at least find the problem would be gratefully appreciated. As Peter kind of alluded to being able to play both recordings and video's and I would add music files? in the new web interface would be useful to some users. Using HLS would be one way to achieve that. The big problem I had when I tried it was lack of CPU power in my BE machine to keep up so it was unusable to use it in real time :( I haven't tried it for many years though so not sure if it still works at all.

I don't know for sure but I suspect the missing libx264 flag is a red herring. We use our own copy of ffmpeg and if you look at mythffmpeg --version for example it clearly says it was compiled with libx264 support but only if you explicitly added the option configure to enable it. I checked the Ubuntu builds and they do already add the correct compile flags and mythffmpeg does show support is built in. No idea why mythtranscode does not show it has support though but since it should be using our ffmpeg libs it should still be able to find what it needs from there?

Regarding why we don't just use ffmpeg to transcode to HLS my guess the reason is so you can use commercial skip and maybe it is so we can use storage groups? Even so an interesting test would be to see if our mythffmpeg can transcode and stream a file using HLS. At lease we would then know it is mythtranscode and not the ffmpeg libs that is broken.
white_haired_uncle
Senior
Posts: 211
Joined: Thu Feb 23, 2023 8:55 pm
Location: Safe outside my gilded cage
United States of America

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by white_haired_uncle »

I can play some recordings/videos in the new web interface just by using the download link. For example, AV1 files stream immediately, while TS download and MPG download and open with an app (I assume this is all dependent on my browser, I can set AV1 to "Open in Firefox", while MPEG and MPEG-4 I can't). Even watched one on my not-very-smartphone.

BTW, I get pretty much the same error as @BigEd when I try to transcode (not http streaming).

Code: Select all

Aug 18 15:06:17 mythbackend mythtranscode: mythtranscode[1238986]: I CoreContext transcode.cpp:1026 (TranscodeFile) Transcoding Video and Audio
Aug 18 15:06:17 mythbackend mythtranscode: mythtranscode[1238986]: E CoreContext NuppelVideoRecorder.cpp:2376 (WriteVideo) NVR(): video encode error: Invalid argument (0)
Aug 18 15:06:18 mythbackend mythtranscode: message repeated 506 times: [ mythtranscode[1238986]: E CoreContext NuppelVideoRecorder.cpp:2376 (WriteVideo) NVR(): video encode error: Invalid argument (0)]
Aug 18 15:06:18 mythbackend mythtranscode: mythtranscode[1238986]: I SendMessage mythcorecontext.cpp:460 (ConnectCommandSocket) MythCoreContext::ConnectCommandSocket(): Connecting to backend server: 172.30.219.113:6543 (try 1 of 1)
Aug 18 15:06:18 mythbackend mythtranscode: mythtranscode[1238986]: E CoreContext NuppelVideoRecorder.cpp:2376 (WriteVideo) NVR(): video encode error: Invalid argument (0)
Aug 18 15:06:18 mythbackend mythtranscode: message repeated 6 times: [ mythtranscode[1238986]: E CoreContext NuppelVideoRecorder.cpp:2376 (WriteVideo) NVR(): video encode error: Invalid argument (0)]
Aug 18 15:06:18 mythbackend mythtranscode: mythtranscode[1238986]: I SendMessage mythcorecontext.cpp:1708 (CheckProtoVersion) MythCoreContext::CheckProtoVersion(): Using protocol version 91 BuzzOff
Aug 18 15:06:18 mythbackend mythtranscode: mythtranscode[1238986]: E CoreContext NuppelVideoRecorder.cpp:2376 (WriteVideo) NVR(): video encode error: Invalid argument (0)
Aug 18 15:06:18 mythbackend mythtranscode: message repeated 23 times: [ mythtranscode[1238986]: E CoreContext NuppelVideoRecorder.cpp:2376 (WriteVideo) NVR(): video encode error: Invalid argument (0)]
resulting in an unwatchable video:

Code: Select all

[nuv @ 0x559d85884a00] Estimating duration from bitrate, this may be inaccurate
[nuv @ 0x559d85884a00] Could not find codec parameters for stream 0 (Video: mpeg4 (DIVX / 0x58564944), none, 720x480): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, nuv, from '/export/video2/2036_20231027130000.ts':
  Duration: 00:32:41.02, start: 8497.737000, bitrate: 1411 kb/s
  Stream #0:0: Video: mpeg4 (DIVX / 0x58564944), none, 720x480, SAR 32:27 DAR 16:9, 29.97 fps, 29.97 tbr, 1k tbn
  Stream #0:1: Audio: pcm_s16le (RAWA / 0x41574152), 48000 Hz, 2 channels, s16, 1536 kb/s
P.S. Are issues with the new web interface being tracked somewhere?

P.P.S.

Code: Select all

being able to play both recordings and video's and I would add music files? 
Back when mythmusic could play directly from my music collection and didn't require its own copies I used it quite a lot. My living room PC/TV/amp are dedicated to FE, so it was just really convenient. But if I was using a web interface (probably on a laptop/table/phone, with local display/sound) to play video, I don't see where adding music really brings anything to the table when I can just open another tab and browse to my music. At one point, I thought "mythmusic" was something the new web interface (which needs a unique name) was missing, but after thinking about it I realized I probably wouldn't use it anyway.
User avatar
paulh
Developer
Posts: 905
Joined: Thu Feb 06, 2014 6:09 pm
Great Britain

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by paulh »

Yeah some browsers can play some file types out of the box. Fun fact :) I believe an ex MythTV dev Jean-Yves is working for the FireFox web browser developers on their internal player :ugeek: The problem for us is I don't think any web browser supports TS files which is the format many of the recordings made by MythTV end up as. For the playback to work for every users and most web browsers you are really forced to transcode into a more compatible format. If you could transcode every file into multiple formats using different resolutions and/or bit rates and store all those files in advance then streaming becomes relatively easy. Obviously that is not really practical for most uses so we are forced to do the transcode in real time which isn't easy unless you have an expensive hardware encode or have a super fast computer to hand.

Regarding music files TBH that was a little tongue in cheek because I know how much it winds a few devs up whenever I mention the plugins :twisted: Actually playing music files should be the easiest part since I think most browsers will be able to play most formats OK you just have to stream the music data to the browser.

The best place to report any issues with the WebApp is the MythTV github issue tracker https://github.com/MythTV/mythtv/issues/new/choose Because the WebApp in the current v33-fixes was an early pre-release it's really not useful to report problems with that version though unless you can also reproduce it in the master version.
BigEd
Newcomer
Posts: 11
Joined: Wed Oct 25, 2023 8:59 am
Canada

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by BigEd »

Thank you Paul, Peter and all the developers for the time and effort you put into MythTV, I really appreciate that. My MythMusic and MythVideo works fine. The only thing not functioning like it use to is HLS. Hopefully more developers with the expertise to fix it will join the team soon. I will keep troubleshooting to see if I can find anything useful and helpful.

I took Peter's advice and use the following Ffmpeg command to create the HLS files. I will put it in a script and set it up as a user job.

Code: Select all

ffmpeg -thread_queue_size 512 -async 1 -vaapi_device /dev/dri/renderD128 -i /media/disk6/TVshows/1291_20161125073000.mpg -vf 'format=nv12,hwupload,scale_vaapi=w=640:h=360' -ac 2 -c:a libmp3lame -ar 44100 -b:a 128k -c:v h264_vaapi -r 30 -b:v 1000k -preset ultrafast -tune zerolatency -hls_flags single_file "/var/lib/mythtv/streaming/BigBangTheory.m3u8"
paulh wrote:
Sat Oct 28, 2023 3:14 pm
Obviously that is not really practical for most uses so we are forced to do the transcode in real time which isn't easy unless you have an expensive hardware encode or have a super fast computer to hand.
I use Ffmpeg hardware acceleration to offload the decoding and encoding process from the CPU to the integrated GPU. The GPU handles that more efficiently and much faster than the CPU, encoding to H264 and saving the CPU all the stress and hardwork to focus on the main processes. It is supported on Intel, AMD and Nvidia GPU. My backend has an Intel Core i5 CPU with an integrated GPU so there is no need to buy any extra expensive graphics card to achieve this. More info can be found on the Ffmpeg wiki below:

https://trac.ffmpeg.org/wiki/HWAccelIntro

Kudos to you guys. Keep up the good work.
freerj
Newcomer
Posts: 2
Joined: Sun Sep 08, 2019 5:49 pm
United States of America

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by freerj »

Great thread. I was digging into this as well... I travel a lot and it would be fantastic to stream a few shows like local news to my phone at lower (transcoded) bitrate while sitting in the airport. I'm also getting the above noted mythtranscode errors and zero size files. I also would be super excited to have a pathway to use ffmpeg to allow for nvidia hardware acceleration which should be able to keep up with transcode on the fly on my HW.

Let me know if/whether I can assist with logs or testing.
BigEd
Newcomer
Posts: 11
Joined: Wed Oct 25, 2023 8:59 am
Canada

Re: This is why mythtranscode - HTTP Live streaming (HLS) is broken

Post by BigEd »

For the people with Nvidia graphic cards who want to use hardware acceleration for transcoding with ffmpeg, there is a catch according to the ffmpeg wiki.

https://trac.ffmpeg.org/wiki/HWAccelInt ... NVENCNVDEC

Your GPU has to support NVENC encoding and NVDEC decoding. Check the list of supported GPUs using the following URL.

https://developer.nvidia.com/video-enco ... matrix-new

If your GPU is supported, you need to check if your ffmpeg was compiled with --enable-cuda-llvm, and configured with --enable-ffnvcodec and libnpp.

Code: Select all

ffmpeg --version | grep -i enable-cuda-llvm
ffmpeg --version | grep -i enable-ffnvcodec
ffmpeg --version | grep -i libnpp
If your ffmpeg was not compiled and configured with the required codec and options, refer to:

https://docs.nvidia.com/video-technolog ... index.html

After confirming that, your command will be something like the following according to the wiki.

Code: Select all

ffmpeg -hwaccel_device 0 -hwaccel cuda -i input -vf scale_npp=-1:360 -c:v h264_nvenc -preset slow output.mp4
My Nvidia Geforce GPUs are legacy, they do not support NVENC and NVDEC so I cannot test this. If you want to generate the HLS files with the master playlist, replace the output section of the command with the following HLS option in your ffmpeg command.

-hls_flags single_file "/var/lib/mythtv/streaming/YourOutputFile.m3u8"

Your final command should be like the following.

Code: Select all

ffmpeg -hwaccel_device 0 -hwaccel cuda -i input -vf scale_npp=-1:360 -c:v h264_nvenc -preset slow -hls_flags single_file "/var/lib/mythtv/streaming/YourOutputFile.m3u8"
Now, mythtranscode creates an html file for the HLS stream to display the transcoded video on the webpage. I have tried copying and editing the html file, pointing to the correct HLS master playlist file created by the ffmpeg command I used to transcode but the transcoded video doesn't show up on the webpage. I don't have a Java environment setup to open the Webfrontend files. I tried opening one file, I think it was mythtranscode but it was too big for my text editor. I even tried the VI editor on the terminal. This is the stage I'm currently on. The content of the html file is as follows.

Code: Select all

<html>
  <head>
    <title>/media/disk6/TVshows/1291_20161125073000.mpg</title>
  </head>
  <body style='background-color:#FFFFFF;'>
    <center>
      <video controls>
        <source src='BigBangTheory.m3u8' />
      </video>
    </center>
  </body>
</html>
Post Reply