Intermittent corrupt recordings

Every so often I get a recording that won't play back. Last night I tried to watch a show I recorded off of PBS and it wouldn't play. I let it sit for a bit just to see what happens and after a few minutes it started playing audio with no video. I copied the file from the DVR computer to my desktop and it wouldn't play back there either.

I'm running the Channels server on Windows 11 with a HDFX-4K as the tuner.

Here's the logs from the recording:

2024/10/29 21:00:00.014899 [DVR] Starting job 1730253600-2 Frontline on ch=[11.1]
2024/10/29 21:00:00.014899 [DVR] Waiting 9h59m59.985101s until next job 1730289600-ch11.2 Broadway's Brightest Lights
2024/10/29 21:00:00.014899 [DBG] Scheduling wake timer for scheduled recording in 9h58m29.985101s
2024/10/29 21:00:00.361771 [TNR] Opened connection to 10AA45AD/2 for ch11.1 WTTW HD
2024/10/29 21:00:00.362121 [DVR] Recording for job 1730253600-2 from 10AA45AD ch11.1 into "TV\Frontline\Frontline S43E09 American Voices 2024 2024-10-29-2100.mpg" for 1h29m59.985101s
2024/10/29 21:00:00.478144 [IDX] Generating video index for job 1730253600-2
2024/10/29 22:30:00.021800 [TNR] Closed connection to 10AA45AD/2 for ch11.1 WTTW HD
2024/10/29 22:30:00.042711 [SNR] Signal statistics for "TV\Frontline\Frontline S43E09 American Voices 2024 2024-10-29-2100.mpg": ss=99%,96%-100% snq=100% seq=100% bps=6653618,3758496-7960672 pps=569,323-683
2024/10/29 22:30:00.059348 [SNR] Buffer statistics for "TV\Frontline\Frontline S43E09 American Voices 2024 2024-10-29-2100.mpg": buf=0% drop=0%
2024/10/29 22:30:00.071511 [DVR] Finished job 1730253600-2 Frontline
2024/10/29 22:30:00.102795 [DVR] Processing file-873: TV\Frontline\Frontline S43E09 American Voices 2024 2024-10-29-2100.mpg
2024/10/29 22:30:00.103442 [DVR] Waiting 8h29m59.8965572s until next job 1730289600-ch11.2 Broadway's Brightest Lights
2024/10/29 22:30:00.103442 [DBG] Scheduling wake timer for scheduled recording in 8h28m29.8965572s

I didn't see any log message when I tried playing it back on my Firestick, but I did see log messages when I tried playing it back from admin website.

2024/10/30 18:58:43.936390 [ENC] Starting encoder for Frontline S43E09 American Voices 2024 2024-10-29-2100.mpg in D:\channels-data\Streaming\file873-ip192.168.0.93-2433726418\encoder-303-3978153632 at 303 (346.034633) (encoder=h264_mf, codec=h264, acodec=aac, resolution=0, deinterlacer=blend, bitrate=8720, segment_size=0.01)
2024/10/30 18:58:43.981239 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] start time for stream 0 is not set in estimate_timings_from_pts
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] start time for stream 1 is not set in estimate_timings_from_pts
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] start time for stream 2 is not set in estimate_timings_from_pts
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 4, dts = 1199827095), dropping it.
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 5, dts = 1199835388), dropping it.
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 6, dts = 1199835388), dropping it.
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] stream 0 : no TS found at start of file, duration not set
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] stream 1 : no TS found at start of file, duration not set
2024/10/30 18:58:43.983144 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] stream 2 : no TS found at start of file, duration not set
2024/10/30 18:58:43.983658 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Could not find codec parameters for stream 0 (Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv)): unspecified size
2024/10/30 18:58:43.983658 [HLS] ffmpeg: file873-ip192.168.0.93:  Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (8000000) options
2024/10/30 18:58:43.983941 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Could not find codec parameters for stream 1 (Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp): unspecified sample rate
2024/10/30 18:58:43.983941 [HLS] ffmpeg: file873-ip192.168.0.93:  Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (8000000) options
2024/10/30 18:58:43.983941 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Could not find codec parameters for stream 2 (Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp): unspecified sample rate
2024/10/30 18:58:43.983941 [HLS] ffmpeg: file873-ip192.168.0.93:  Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (8000000) options
2024/10/30 18:58:43.985472 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 5, dts = 1199835388), dropping it.
2024/10/30 18:58:43.985472 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 6, dts = 1199835388), dropping it.
2024/10/30 18:58:43.985472 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 4, dts = 1199827095), dropping it.
2024/10/30 18:58:43.985472 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 5, dts = 1199835388), dropping it.
2024/10/30 18:58:43.985472 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 6, dts = 1199835388), dropping it.
2024/10/30 18:58:43.986562 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 4, dts = 1199827095), dropping it.
2024/10/30 18:58:43.986562 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 5, dts = 1199835388), dropping it.
2024/10/30 18:58:43.986562 [HLS] ffmpeg: file873-ip192.168.0.93:  [mpegts @ 00000000012bc140] Packet corrupt (stream = 6, dts = 1199835388), dropping it.
2024/10/30 18:59:10.844535 [ENC] Stopped encoder for Frontline S43E09 American Voices 2024 2024-10-29-2100.mpg in D:\channels-data\Streaming\file873-ip192.168.0.93-2433726418\encoder-303-3978153632 after starting from 303 without encoding any segments

Any ideas what's causing this? How to prevent it? How to fix a corrupted file?

Using what app?
Did you try with VLC player?

Yes. I tried several different programs including VLC. It wouldn't play on any of them. I also tried a different random recording and it played just fine on all the programs I tried. Something happened with this recording, but I don't know what and I don't know how to fix the file, if that's even possible. Since the file is over 4GB, I'm sure the recording is there, but something is missing or corrupted that prevents it from playing. While other files show a preview image, this one does not.
image

When I look at the properties it doesn't have any length and all the details seem incorrect.

Looks like it's an SD recording (704x480pixels).
What I do with problem recordings is to remux them using ffmpeg.

If the remuxed file plays then rename the remuxed file extension from .ts to .mpg and move the remuxed file over the original recording. Then do a Refresh Metadata on that recording.

I had the same issue on PBS recordings via VLC and HLS streaming and the fix was to run fix video timestamps on the recording.

That could totally ruin it (has for me).
I would do the ffmpeg remux first. If that doesn't work, most likely fix video timestamps won't either. At least doing the ffmpeg remux doesn't overwrite the original recording.

Hmm. That didn't seem to work. I tried running version 7.1. I'm pretty sure I copied your command correctly
ffmpeg -i f:\TV\Fix\FrontlineS43E09.mpg -map 0 -acodec copy -vcodec copy -scodec copy -dcodec copy -copy_unknown f:\TV\Fix\FrontlineS4E09fix.ts

 [mpeg2video @ 000001f01d3d9080] Invalid frame dimensions 0x0.
    Last message repeated 28 times
[mpegts @ 000001f01d338880] start time for stream 0 is not set in estimate_timings_from_pts
[mpegts @ 000001f01d338880] start time for stream 1 is not set in estimate_timings_from_pts
[mpegts @ 000001f01d338880] start time for stream 2 is not set in estimate_timings_from_pts
[mpegts @ 000001f01d338880] PES packet size mismatch
[mpegts @ 000001f01d338880] Packet corrupt (stream = 4, dts = 1199827095).
[mpegts @ 000001f01d338880] PES packet size mismatch
[mpegts @ 000001f01d338880] Packet corrupt (stream = 5, dts = 1199835388).
[mpegts @ 000001f01d338880] PES packet size mismatch
[mpegts @ 000001f01d338880] Packet corrupt (stream = 6, dts = 1199835388).
[mpegts @ 000001f01d338880] stream 0 : no TS found at start of file, duration not set
[mpegts @ 000001f01d338880] stream 1 : no TS found at start of file, duration not set
[mpegts @ 000001f01d338880] stream 2 : no TS found at start of file, duration not set
[mpegts @ 000001f01d338880] Could not find codec parameters for stream 0 (Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv)): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 000001f01d338880] Could not find codec parameters for stream 1 (Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 000001f01d338880] Could not find codec parameters for stream 2 (Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from 'f:\TV\Fix\FrontlineS43E09.mpg':
  Duration: 01:30:00.28, start: 7931.824311, bitrate: 6656 kb/s
  Program 3
  Stream #0:0[0x131]: Video: mpeg2video ([2][0][0][0] / 0x0002), none(tv), 90k tbr, 90k tbn
  Stream #0:1[0x134]: Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp
  Stream #0:2[0x135]: Audio: ac3 (AC-3 / 0x332D4341), 0 channels, fltp
  Stream #0:3[0x31]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn
      Side data:
        cpb: bitrate max/min/avg: 64000000/0/0 buffer size: 9781248 vbv_delay: N/A
  Stream #0:4[0x34](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 384 kb/s
  Stream #0:5[0x35](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
  Stream #0:6[0x36](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
  Stream #0:4 -> #0:4 (copy)
  Stream #0:5 -> #0:5 (copy)
  Stream #0:6 -> #0:6 (copy)
[mpegts @ 000001f01db136c0] sample rate not set
[out#0/mpegts @ 000001f01d3deec0] Could not write header (incorrect codec parameters ?): Invalid argument
Conversion failed!

That's messed up!
Most likely missing or bad PMT in the transport stream from your PBS station.
That's assuming that Channels DVR is recording the stream as is from the HDHR and not manipulating it.

The main HD Video is in Stream #0:3 but should be in Stream #0:0
The associated Audio tracks are in Streams #0:4, #0:5 and #0:6. They should be in #0:1, #0:2 and #0:3.

Can you open the recording in TSReader Lite Download TSReader Lite

Sounds like something may have glitched in the HDHR when it started the recording. What's interesting is last night I recorded back to back shows in PBS. The first show glitched, the second show recorded without issue. I ran the one that failed through ffmpeg and got the exact same results as the other file.

yes it's good advice. It's the whole reason behind my feature request: Add expected_duration to api/v1/episodes

I've found ffmpeg can fix about 95% of things. With a bit of coding this entire flow can be automated where it can detect the issues and fix them automatically.

My fix command is:

ffmpeg -err_detect ignore_err -hide_banner -loglevel error -i 'input.mpg' -c copy output.mkv

Thanks. That did the trick, and super fast too. For some reason it didn't like the single quotes on the input file, but once I removed those it worked.
You're right, I don't know why they don't include information needed to detect this issue within Channels, or even include the fix within Channels.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.