My transcoding is always riddled with errors

I have pretty low expectations with the Pi being able to serve away-from-home, but i get the sense that something is wrong.

I haven't left my house that much since getting channels (damned COVID), but even web player in my house is pretty error-filled. I'm on hardware / blend / adaptive on.

Example - playing a cable-based HDHR recording from a different house on wifi now. Log is riddled with:
2021/05/28 08:52:58.727441 [ENC] Starting encoder for Pardon the Interruption 2021-05-26-1729.mpg in /media/DVR/Streaming/file2083-600b23810307-178056286/encoder-0-640130597 at 0 (0.000000) (encoder=h264_v4l2m2m, resolution=720, deinterlacer=blend, bitrate=8000 segment_size=0.01)
2021/05/28 08:52:58.741602 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0xdbe7060] Dropped corrupted packet (stream = 0)
2021/05/28 08:52:58.758424 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0xdbe7060] stream 0 : no PTS found at end of file, duration not set
2021/05/28 08:53:32.227722 [ENC] Request for 26 is for different transcoding parameters at 6mbps
2021/05/28 08:53:32.282313 [ENC] Stopped encoder for Pardon the Interruption 2021-05-26-1729.mpg in /media/DVR/Streaming/file2083-600b23810307-178056286/encoder-0-640130597 after encoding 0 to 34
2021/05/28 08:53:32.285621 [ENC] Starting encoder for Pardon the Interruption 2021-05-26-1729.mpg in /media/DVR/Streaming/file2083-600b23810307-178056286/encoder-26-373724596 at 26 (25.775933) (encoder=h264_v4l2m2m, resolution=720, deinterlacer=blend, bitrate=6000 segment_size=0.01)
2021/05/28 08:53:32.303636 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0x332b2080] Dropped corrupted packet (stream = 0)
2021/05/28 08:53:32.306059 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0x332b2080] stream 0 : no PTS found at end of file, duration not set
2021/05/28 08:53:32.315001 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0x332b2080] Dropped corrupted packet (stream = 0)

Any issues with the remote playback or are you just questioning the log entries?
Have you tried with adaptive off?

Only thing I see that seems abnormal is that it can't determine the duration of the recording it's streaming.

Remote outright stopped playing about 30 seconds in.

That being said, from memory (I'll confirm once home again) - i get nearly identical errors when i use the web player in the house, so this isn't just an "away from home" issue (and in my mind elminates some common causes of issues)

I would try with adaptive off to see if it helps.

Nope - really worse, in all honesty.

2021/05/28 13:08:36.595949 [ENC] Next segment to pre-encode of 170 is 2m4.808010001s from the last request of 47
2021/05/28 13:08:36.615228 [ENC] Starting encoder for Pardon the Interruption 2021-05-26-1729.mpg in /media/DVR/Streaming/file2083-600b23810307-483213961/encoder-170-954332067 at 170 (174.140809) (encoder=h264_v4l2m2m, resolution=720, deinterlacer=blend, bitrate=8000 segment_size=0.01)
2021/05/28 13:08:36.636085 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0x2d434080] Dropped corrupted packet (stream = 0)
2021/05/28 13:08:36.669033 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0x2d434080] stream 0 : no PTS found at end of file, duration not set
2021/05/28 13:08:36.673011 [HLS] ffmpeg: file2083-600b23810307: [mpegts @ 0x2d434080] Dropped corrupted packet (stream = 0)

Does it only happen with that ESPN recording or all your recordings?

How many streams are you transcoding at once? The encoder can only support a single stream.

Also, I've found the Pi's hardware encoding to be less-than-stellar. Have you tried using the software transcoder? Or changing the de-interlacing?

Also, what was the source of the recording? Was it a TVE/internet stream, or a proper cable feed?

All recordings, though i haven't tried to narrow to original source that much, etc.

He said HDHR cable

always only 1. Like i said, i have low expectations :slight_smile:

Software is same, if not worse.

I'm actually wondering out loud if my cable signal (i.e. from source) is at fault, and ffmpeg is merely highlighting that. I'll try some OTA and TVE recordings next.

Could be Video Index for recording is bad.
Try this.
Stop playing the recording.
Clear Streaming Cache in the Transcoder section of your DVR web UI.
Regenerate Video Index on the recording.
When it's done regenerating the index, try playing it again.

That was why I asked about the source. The errors that are being reported show the transcoding is having issues because of corruption in the source files. You may want to enable viewing of the stats while watching a live stream from cable, or monitor the stats on the DVR's activity pane while a recording is in progress. That will help to clue you in if there are signal issues. (Also, with the Prime, a 100% for signal strength is often an indicator of a too strong signal, which causes issues. In that case, a splitter or attenuator may help to mitigate the problem.)

Also, perhaps sharing the SNR lines from the DVR log of a recording that is problematic may help, too. Although, without details, everything is guess work. We can only use the information you have shared.

Not sure which file it means, recording file or video index file or HLS stream chunk file.

Regenerated a video index on a different episode of same show. Similar:

2021/05/28 13:34:21.779683 [ENC] Starting encoder for Pardon the Interruption 2021-05-27-1729.mpg in /media/DVR/Streaming/file2087-600b23810307-353698328/encoder-0-786251927 at 0 (0.000000) (encoder=h264_v4l2m2m, resolution=720, deinterlacer=blend, bitrate=8000 segment_size=0.01)
2021/05/28 13:34:21.793063 [HLS] ffmpeg: file2087-600b23810307: [mpegts @ 0xa343060] Dropped corrupted packet (stream = 0)
2021/05/28 13:34:39.211350 [ENC] Segment 18 has unexpected duration: inputs=34-36 expected=1.001 actual=1.084423 expected_pts=18.101423-19.102423 actual_pts=17.951700-19.019433
2021/05/28 13:34:52.281414 [ENC] Request for 24 is for different transcoding parameters at 6mbps
2021/05/28 13:34:52.305828 [ENC] Stopped encoder for Pardon the Interruption 2021-05-27-1729.mpg in /media/DVR/Streaming/file2087-600b23810307-353698328/encoder-0-786251927 after encoding 0 to 33
2021/05/28 13:34:52.310491 [ENC] Starting encoder for Pardon the Interruption 2021-05-27-1729.mpg in /media/DVR/Streaming/file2087-600b23810307-353698328/encoder-24-710165719 at 24 (23.106423) (encoder=h264_v4l2m2m, resolution=720, deinterlacer=blend, bitrate=6000 segment_size=0.01)
2021/05/28 13:34:52.323078 [HLS] ffmpeg: file2087-600b23810307: [mpegts @ 0x2b21080] Dropped corrupted packet (stream = 0)
2021/05/28 13:35:08.453963 [ENC] Segment 38 has unexpected duration: inputs=55-57 expected=1.251245 actual=1.5015 expected_pts=38.755389-40.006634 actual_pts=38.667756-40.152567
2021/05/28 13:35:10.162929 [ENC] Segment 40 has unexpected duration: inputs=60-61 expected=1.117789 actual=1.2012 expected_pts=41.207834-42.325623 actual_pts=40.920000-42.104522
2021/05/28 13:35:11.228049 [ENC] Segment 41 has unexpected duration: inputs=62-63 expected=1.001 actual=1.117789 expected_pts=42.325623-43.326623 actual_pts=42.121200-43.222300
2021/05/28 13:35:14.226393 [ENC] Segment 44 has unexpected duration: inputs=69-72 expected=1.167833 actual=1.468133 expected_pts=45.378667-46.546500 actual_pts=45.291033-46.742489
2021/05/28 13:35:17.136195 [ENC] Segment 47 has unexpected duration: inputs=78-81 expected=1.434767 actual=1.6016 expected_pts=48.548500-49.983267 actual_pts=48.460867-50.045789

Looks like that one played for about a minute?
Also looks like about 30 seconds into playback the adaptive streaming is dropping the bitrate from 8mbps to 6mbps.

back at home, and similar behavior (but different errors) on TVE with the web player - playing basically hangs. Note - this was set to 720p slower fps:

2021/05/31 06:43:55.617593 [ENC] Starting encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-633288213/encoder-0-663256176 at 0 (0.000000) (encoder=h264_v4l2m2m, resolution=384, deinterlacer=blend, bitrate=500 segment_size=0.01)
2021/05/31 06:43:59.659617 [ENC] Request for 1 is for different transcoding parameters at 2mbps
2021/05/31 06:43:59.677556 [ENC] Stopped encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-633288213/encoder-0-663256176 after encoding 0 to 2
2021/05/31 06:43:59.681526 [ENC] Starting encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-633288213/encoder-1-395662500 at 1 (0.000000) (encoder=h264_v4l2m2m, resolution=720, deinterlacer=blend, bitrate=2350 segment_size=0.01)
2021/05/31 06:44:22.578974 [ENC] Stopped encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-633288213/encoder-1-395662500 after encoding 1 to 11

Similar even turned down to 240p 360Kbps:
2021/05/31 06:46:31.837701 [ENC] Starting encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-506110144/encoder-2-936039199 at 2 (2.003644) (encoder=h264_v4l2m2m, resolution=240, deinterlacer=blend, bitrate=360 segment_size=0.01)
2021/05/31 06:46:41.325676 [ENC] Request for 6854 is more than 10 from the last encoded segment of 9
2021/05/31 06:46:41.344528 [ENC] Stopped encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-506110144/encoder-2-936039199 after encoding 2 to 9
2021/05/31 06:46:41.348149 [ENC] Starting encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-506110144/encoder-6854-971851738 at 6854 (14035.476403) (encoder=h264_v4l2m2m, resolution=240, deinterlacer=blend, bitrate=360 segment_size=0.01)
2021/05/31 06:46:50.511947 [ENC] Stopped encoder for College Baseball Big East Tournament Final Teams TBA 2021-05-30-1629.mpg in /media/DVR/Streaming/file2114-ip192.168.50.1-506110144/encoder-6854-971851738 after encoding 6854 to 6860

No improvement - if i didn't know better, i would wonder if newer ffmpeg versions don't like the dedicated pi build (or something got deprecated)

2021/06/20 07:56:39.464935 [ENC] Starting encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-0-811073442 at 0 (0.000000) (encoder=h264_v4l2m2m, resolution=384, deinterlacer=blend, bitrate=500 segment_size=0.01)
2021/06/20 07:56:41.779035 [ENC] Request for 1 is for different transcoding parameters at 1mbps
2021/06/20 07:56:41.803501 [ENC] Stopped encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-0-811073442 after encoding 0 to 1
2021/06/20 07:56:41.805967 [ENC] Starting encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-1-288430233 at 1 (0.000000) (encoder=h264_v4l2m2m, resolution=576, deinterlacer=blend, bitrate=1000 segment_size=0.01)
2021/06/20 07:56:45.991668 [ENC] Request for 3027 is more than 10 from the last encoded segment of 3
2021/06/20 07:56:46.012954 [ENC] Stopped encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-1-288430233 after encoding 1 to 3
2021/06/20 07:56:46.015378 [ENC] Starting encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-3027-356242212 at 3027 (6052.217533) (encoder=h264_v4l2m2m, resolution=576, deinterlacer=blend, bitrate=1000 segment_size=0.01)
2021/06/20 07:56:48.464536 [ENC] Request for 3028 is for different transcoding parameters at 500kbps
2021/06/20 07:56:48.488730 [ENC] Stopped encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-3027-356242212 after starting from 3027 without encoding any segments
2021/06/20 07:56:48.492181 [ENC] Starting encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-3028-220580403 at 3028 (6054.219533) (encoder=h264_v4l2m2m, resolution=384, deinterlacer=blend, bitrate=500 segment_size=0.01)
2021/06/20 07:56:52.061317 [ENC] Request for 2829 is lower than current start segment of 3028
2021/06/20 07:56:52.082604 [ENC] Stopped encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-3028-220580403 after encoding 3028 to 3029
2021/06/20 07:56:52.085102 [ENC] Starting encoder for NHL Hockey Tampa Bay Lightning at New York Islanders 2021-06-19-2117.mpg in /media/DVR/Streaming/file2178-ip192.168.50.1-111163791/encoder-2829-034941942 at 2829 (5656.222533) (encoder=h264_v4l2m2m, resolution=384, deinterlacer=blend, bitrate=500 segment_size=0.01)
2021/06/20 07:56:55.191371 [ENC] Request for 3030 is more than 10 from the last encoded segment of 2829

No changes here. No matter the source, strength, resolution, etc - anything transcoding off of the pi is a mess.

Tried some OTA examples today, including a 480p channel, which should be less taxing, and it's still erroring.

2021/08/14 09:37:12.940597 [TNR] Opened connection to 1080D51F/2 for ch2.1 WCBS-HD
2021/08/14 09:37:12.943957 [HLS] Starting transcoder for channel 2.1 from 192.168.50.1 (encoder=remux, resolution=, deinterlacer=, bitrate=0)
2021/08/14 09:37:15.128382 [HLS] Probed live stream in 2.184029736s: mpeg2video 1920x1080 tt 10848534bps
2021/08/14 09:37:18.199804 [HLS] Session ch2.1-dANY-ip192.168.50.1 started in 5.622041841s
2021/08/14 09:37:18.202791 [ENC] Starting encoder for ch2.1 in /media/DVR/Streaming/ch2.1-dANY-ip192.168.50.1-042738135/encoder-1-538775370 at 1 (2.584000) (encoder=h264_v4l2m2m, resolution=1080, deinterlacer=blend, bitrate=10000 segment_size=0.01)
2021/08/14 09:37:18.872199 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-1-h264-aac---10000-256-1080-0-0--blend-false-false-0.01: [h264_v4l2m2m @ 0x241ed120] output VIDIOC_REQBUFS failed: Cannot allocate memory
2021/08/14 09:37:18.872344 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-1-h264-aac---10000-256-1080-0-0--blend-false-false-0.01: [h264_v4l2m2m @ 0x241ed120] no v4l2 output context's buffers
2021/08/14 09:37:18.872443 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-1-h264-aac---10000-256-1080-0-0--blend-false-false-0.01: [h264_v4l2m2m @ 0x241ed120] can't configure encoder
2021/08/14 09:37:18.872581 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-1-h264-aac---10000-256-1080-0-0--blend-false-false-0.01: Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
2021/08/14 09:37:18.883270 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-1-h264-aac---10000-256-1080-0-0--blend-false-false-0.01: [aac @ 0x242055d0] 2 frames left in the queue on closing
2021/08/14 09:37:18.883711 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-1-h264-aac---10000-256-1080-0-0--blend-false-false-0.01: [aac @ 0x24203b50] 2 frames left in the queue on closing
2021/08/14 09:37:18.978758 [ENC] Encoder stopped for ch2.1 in /media/DVR/Streaming/ch2.1-dANY-ip192.168.50.1-042738135/encoder-1-538775370 after starting from 1 without encoding any segments
2021/08/14 09:37:18.986152 [ENC] Starting encoder for ch2.1 in /media/DVR/Streaming/ch2.1-dANY-ip192.168.50.1-042738135/encoder-1-569880097 at 1 (2.584000) (encoder=h264_v4l2m2m, resolution=1080, deinterlacer=blend, bitrate=10000 segment_size=0.01)
2021/08/14 09:37:36.023500 [HLS] Stopping transcoder session ch2.1-dANY-ip192.168.50.1 (out: 23.237978s, finished: false)
2021/08/14 09:37:36.055408 [ENC] Stopped encoder for ch2.1 in /media/DVR/Streaming/ch2.1-dANY-ip192.168.50.1-042738135/encoder-1-569880097 after encoding 1 to 6
2021/08/14 09:37:36.056213 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-remux: [mpegts @ 0xf9dbdd0] Dropped corrupted packet (stream = 1)
2021/08/14 09:37:36.056602 [HLS] ffmpeg: ch2.1-dANY-ip192.168.50.1-remux: [mpegts @ 0xf9dbdd0] Dropped corrupted packet (stream = 2)
2021/08/14 09:37:36.067840 [TNR] Closed connection to 1080D51F/2 for ch2.1 WCBS-HD
2021/08/14 09:37:36.067942 [SNR] Statistics for ch2.1 WCBS-HD: ss=100% snq=100% seq=100% bps=12754421,7137984-14685056 pps=1091,611-1256
2021/08/14 09:38:01.538949 [TNR] Opened connection to 1080D51F/2 for ch13.1 WNET-HD
2021/08/14 09:38:01.541805 [HLS] Starting transcoder for channel 13.1 from 192.168.50.1 (encoder=remux, resolution=, deinterlacer=, bitrate=0)
2021/08/14 09:38:01.814247 [HLS] Probed live stream in 272.043712ms: mpeg2video 1920x1080 tt 2385998bps
2021/08/14 09:38:02.851087 [HLS] Session ch13.1-dANY-ip192.168.50.1 started in 1.629334599s
2021/08/14 09:38:02.856456 [ENC] Starting encoder for ch13.1 in /media/DVR/Streaming/ch13.1-dANY-ip192.168.50.1-736153695/encoder-1-663459890 at 1 (0.732989) (encoder=h264_v4l2m2m, resolution=1080, deinterlacer=blend, bitrate=10000 segment_size=0.01)
2021/08/14 09:38:14.772353 [HLS] Stopping transcoder session ch13.1-dANY-ip192.168.50.1 (out: 13.512433s, finished: false)
2021/08/14 09:38:14.793095 [ENC] Stopped encoder for ch13.1 in /media/DVR/Streaming/ch13.1-dANY-ip192.168.50.1-736153695/encoder-1-663459890 after encoding 1 to 7
2021/08/14 09:38:14.793757 [HLS] ffmpeg: ch13.1-dANY-ip192.168.50.1-remux: [mpegts @ 0x3633add0] Dropped corrupted packet (stream = 1)
2021/08/14 09:38:14.793856 [HLS] ffmpeg: ch13.1-dANY-ip192.168.50.1-remux: [mpegts @ 0x3633add0] Dropped corrupted packet (stream = 2)
2021/08/14 09:38:14.793882 [HLS] ffmpeg: ch13.1-dANY-ip192.168.50.1-remux: [mpegts @ 0x3633add0] Dropped corrupted packet (stream = 3)
2021/08/14 09:38:14.801788 [TNR] Closed connection to 1080D51F/2 for ch13.1 WNET-HD
2021/08/14 09:38:14.803804 [SNR] Statistics for ch13.1 WNET-HD: ss=90%-91% snq=99%,98%-100% seq=85%,0%-100% bps=5731099,0-8124608 pps=491,0-696
2021/08/14 09:40:03.732754 [NAT] Successfully mapped port 8089 using natpmp
2021/08/14 09:41:07.410762 [TNR] Opened connection to 1080D51F/2 for ch21.2 Create
2021/08/14 09:41:07.414262 [HLS] Starting transcoder for channel 21.2 from 192.168.50.1 (encoder=remux, resolution=, deinterlacer=, bitrate=0)
2021/08/14 09:41:07.954900 [HLS] Probed live stream in 539.826502ms: mpeg2video 704x480 tt 700601bps
2021/08/14 09:41:09.370838 [HLS] Session ch21.2-dANY-ip192.168.50.1 started in 2.333744704s
2021/08/14 09:41:09.377589 [ENC] Starting encoder for ch21.2 in /media/DVR/Streaming/ch21.2-dANY-ip192.168.50.1-762685415/encoder-1-894989338 at 1 (1.351911) (encoder=h264_v4l2m2m, resolution=480, deinterlacer=blend, bitrate=10000 segment_size=0.01)
2021/08/14 09:41:36.841027 [HLS] Stopping transcoder session ch21.2-dANY-ip192.168.50.1 (out: 29.379922s, finished: false)
2021/08/14 09:41:36.868359 [ENC] Stopped encoder for ch21.2 in /media/DVR/Streaming/ch21.2-dANY-ip192.168.50.1-762685415/encoder-1-894989338 after encoding 1 to 26
2021/08/14 09:41:36.869583 [HLS] ffmpeg: ch21.2-dANY-ip192.168.50.1-remux: [mpegts @ 0x28437dd0] Dropped corrupted packet (stream = 1)
2021/08/14 09:41:36.870068 [HLS] ffmpeg: ch21.2-dANY-ip192.168.50.1-remux: [mpegts @ 0x28437dd0] Dropped corrupted packet (stream = 2)
2021/08/14 09:41:36.870158 [HLS] ffmpeg: ch21.2-dANY-ip192.168.50.1-remux: [mpegts @ 0x28437dd0] Dropped corrupted packet (stream = 3)
2021/08/14 09:41:36.878261 [TNR] Closed connection to 1080D51F/2 for ch21.2 Create
2021/08/14 09:41:36.878398 [SNR] Statistics for ch21.2 Create: ss=100% snq=100% seq=100% bps=1806404,565504-2268032 pps=163,52-205

This seems problematic. Is the Pi running out of memory?

Good catch. I'm going to send in diagnostics in the hope that one buffer may be in play, @tmm1 fixed something similar before on the pi build.

8a6dbe55-cb33-4122-b43a-7a72edf946f5 submitted.

I'm half-heartedly thinking of going to the M1 mac mini for channels, as the prices are coming down now, and it's a beast of a machine for purpose, with not too much power consumption cost diff.