First — thank you for the incredibly quick action on the previous timebase and timeline-logging fixes. The turnaround on both was genuinely impressive, and the regression test you added for the 5/90000 case is exactly the right kind of coverage. This is a follow-up reporting a remaining case that the 0.41.3 fix doesn't cover.
(Note: I use AI assistance to help investigate and write up these reports, hence the AI: prefix — but all logs, tests, and reproductions below are from my actual running system.)
Summary
After updating to 0.41.4 (confirmed: LightNVR v0.41.4, build 2026-09-02), the MP4 duration bug persists on all cameras, on fresh recordings (I deleted all prior recordings first to rule out stale files). 300s segments still report ~59s container duration.
Symptom
ffprobe on fresh post-update files:
espcam7/recording_20260904_050120.mp4 → duration = 59.200000
espcam1/… → duration = 59.400000
The database has correct durations; only the MP4 container metadata is wrong:
SELECT (end_time - start_time) AS real_duration, file_path FROM recordings WHERE is_complete=1 ORDER BY id DESC LIMIT 3;
-- real_duration ≈ 300 for all
Full video data is present — a -c copy remux recovers the complete duration — so this is purely wrong container-duration metadata.
Why the 0.41.3 fix doesn't cover this case
The 0.41.3 fix targeted an input→output timebase mismatch (5/90000 input normalized to 1/90000 output) and rescaled packets accordingly.
However, my streams' RTSP output already reports time_base=1/90000 — identical to the muxer output timebase — so there's no mismatch left to rescale, and the fix is a no-op here, yet duration is still wrong.
ffprobe -rtsp_transport tcp rtsp://127.0.0.1:8554/espcam1:
Input #0, rtsp, from 'rtsp://127.0.0.1:8554/espcam1':
title : go2rtc/1.9.14+dev.
Stream #0:0: Video: h264 (High 4:2:2), yuvj422p, 800x600, 5 fps, 5 tbr, 90k tbn, start 0.800000
r_frame_rate=5/1
time_base=1/90000
Key clue: the error factor equals the frame rate
The error ratio is 300 / 59 ≈ 5.08 ≈ the frame rate (5 fps).
This suggests the remaining miscalculation is independent of the timebase mismatch that was fixed, and instead lies in how per-frame duration/PTS increments are computed — the container duration appears under-written by a factor equal to the fps. The timebases now match, but a factor of fps still seems to be dropped in the final duration calculation.
Pipeline
All affected cameras are MJPEG sources transcoded to H.264 by go2rtc's ffmpeg, via the generated source:
ffmpeg:http://<cam-ip>:8080/#video=h264
- Real capture/serve rate: ~5 fps (ESP32-based MJPEG cameras)
- go2rtc: 1.9.14+dev
- Output: H.264, timebase 1/90000
Reproducibility
100% of MJPEG→H.264 transcoded cameras, every fresh segment, on 0.41.4.
Happy to provide a sample file, full -show_streams/-show_format output, or test a patch.
First — thank you for the incredibly quick action on the previous timebase and timeline-logging fixes. The turnaround on both was genuinely impressive, and the regression test you added for the
5/90000case is exactly the right kind of coverage. This is a follow-up reporting a remaining case that the 0.41.3 fix doesn't cover.(Note: I use AI assistance to help investigate and write up these reports, hence the
AI:prefix — but all logs, tests, and reproductions below are from my actual running system.)Summary
After updating to 0.41.4 (confirmed:
LightNVR v0.41.4, build 2026-09-02), the MP4 duration bug persists on all cameras, on fresh recordings (I deleted all prior recordings first to rule out stale files). 300s segments still report ~59s container duration.Symptom
ffprobeon fresh post-update files:The database has correct durations; only the MP4 container metadata is wrong:
Full video data is present — a
-c copyremux recovers the complete duration — so this is purely wrong container-duration metadata.Why the 0.41.3 fix doesn't cover this case
The 0.41.3 fix targeted an input→output timebase mismatch (
5/90000input normalized to1/90000output) and rescaled packets accordingly.However, my streams' RTSP output already reports
time_base=1/90000— identical to the muxer output timebase — so there's no mismatch left to rescale, and the fix is a no-op here, yet duration is still wrong.ffprobe -rtsp_transport tcp rtsp://127.0.0.1:8554/espcam1:Key clue: the error factor equals the frame rate
The error ratio is 300 / 59 ≈ 5.08 ≈ the frame rate (5 fps).
This suggests the remaining miscalculation is independent of the timebase mismatch that was fixed, and instead lies in how per-frame duration/PTS increments are computed — the container duration appears under-written by a factor equal to the fps. The timebases now match, but a factor of
fpsstill seems to be dropped in the final duration calculation.Pipeline
All affected cameras are MJPEG sources transcoded to H.264 by go2rtc's ffmpeg, via the generated source:
Reproducibility
100% of MJPEG→H.264 transcoded cameras, every fresh segment, on 0.41.4.
Happy to provide a sample file, full
-show_streams/-show_formatoutput, or test a patch.