My transcoding is always riddled with errors

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.

tap tap - this thing on? :slight_smile:

Some sort of driver bug. Transcoding support on the Pi is WYSIWYG.

Just for grins and giggles, have you tried using the Old Transcoder?

Also try with adaptive streaming off.
Screenshot 2021-08-20 at 11-05-01 Channels Settings

i've tried both. Thanks, though.

Any possibility that increasing these values would help?
h264_v4l2m2m_encoder AVOptions:
-num_output_buffers <int> E..V...... Number of buffers in the output context (from 6 to INT_MAX) (default 16)
-num_capture_buffers <int> E..V...... Number of buffers in the capture context (from 4 to INT_MAX) (default 4)

Just wondering if there's not enough memory available for the GPU.
Are you using the Channels DVR image only with nothing else runnning on it?
2GB or 4GB model?

image only, 4GB model. Probably as clean as it can be.

What happened when you streamed that 480p channel?
Don't see errors on that and looks like it streamed for 27 seconds before you stopped it.

Doesn't choke as badly/quickly, but chokes eventually.

Have you already ruled out heating issues? I guess it’s also possible you got a lemon.. :cry:

I've had load pretty high up (probably into 8s but most of that is iowait) and have constantly run on 2 core comskip, without any issues. Fan is constant, too, given the dedicated build.

Not 100% out of the question, but i'd be pretty surprised.

maybe it's time to edit https://getchannels.com/raspberry-pi/ , in that case?