Jellyfin Forum
Any way to remux LiveTV encoding from *.TS to *.MKV in realtime for DVR? - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions)
+--- Thread: Any way to remux LiveTV encoding from *.TS to *.MKV in realtime for DVR? (/t-any-way-to-remux-livetv-encoding-from-ts-to-mkv-in-realtime-for-dvr)



Any way to remux LiveTV encoding from *.TS to *.MKV in realtime for DVR? - sausageDeltaFruit - 2024-08-06

I have nothing but trouble with the *.ts files that the DVR recording of Jellyfin LiveTV generates.  This is made even worse when attempting to watch a recording live.  Seeking FF/RW never seem to work, and constantly get stream errors that terminate playback.  Not sure if it's due to OTA hardware transcoder, playback client or what, but I just want to get away from TS all together.

Is there a way to either:
1) Change the output format of the jellyfin DVR recording task to write directly to an MKV instead of TS?

2) Remux the real-time disk write to use the MKV container instead of TS?
  • Original jellyfin writes to the native TS container.
  • When record is started, secondarily trigger an FFMPEG task to watch the TS file as written to disk and remux to MKV as data is written to file?

I'd say #1 is far more efficient, cutting out the middle-man TS file, but not sure if that's possible.
For #2 - is there a way to trigger an action when a recording starts the way a post-processing script can be called?

Recently, I started using a DVR post-processing application script to remux and change containers w/out reencoding once recording is complete, but I'd really like to do this in real-time so I can watch a show while it's recording

I'm using HDHomerun Extend and typically Roku Ultra devices for playback.  I can watch through the HDHomerun directly, but it doesn't allow DVR functions on live TV.  I know I've seen the Roku devices have codec "quirks" that cause a multitude of problems, but they play the remuxed MKV versions just fine, no transcoding needed.

Thoughts/suggestions/other solutions?


RE: Any way to remux LiveTV encoding from *.TS to *.MKV in realtime for DVR? - TheDreadPirate - 2024-08-06

Your post-processing script is THE solution. AFAIK, there are no settings to change the recording container.


RE: Any way to remux LiveTV encoding from *.TS to *.MKV in realtime for DVR? - gnattu - 2024-08-06

I recommend against remuxing it unless you want to fix all the potential issues as well yourself. The recorded ts may contain invalid data from time to time due to the nature of livetv, and changing its container with ffmpeg may result in weird problems like out of sync audio/video.


RE: Any way to remux LiveTV encoding from *.TS to *.MKV in realtime for DVR? - sausageDeltaFruit - 2024-08-06

(2024-08-06, 03:41 PM)TheDreadPirate Wrote: Your post-processing script is THE solution.  AFAIK, there are no settings to change the recording container.

Unfortunately, post-processing is not actually a solution for me b/c I'm looking for a way to do it near real-time (with a minor I/O delay), not simply after a recording is 100% complete.  Lets just say I have a high value, opposite sex, long-term roommate with substantial legal footing who demands reliable live TV watching capabilities.

I figured there'd be a way to hook into the recording trigger at the very least. Confused-face

(2024-08-06, 07:33 PM)gnattu Wrote: I recommend against remuxing it unless you want to fix all the potential issues as well yourself. The recorded TS may contain invalid data from time to time due to the nature of livetv, and changing its container with ffmpeg may result in weird problems like out of sync audio/video.

Yeah, I realize TS is a bit dodgy, but for me, MKV remuxed seem to be far more reliable in general.  I do see some TS encoding jank in the ffmpeg remux output logs, so I keep the original TS around for a short time in case I have no other option.  Given that seeking within TS files just plain never works, I have to do something or else DVR function is completely worthless.