Skip to content

Commit 1634947

Browse files
committed
fix e2e script's one frame drop
1 parent 6fe3adf commit 1634947

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

scripts/dfine_gpu_end2end.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,9 @@ def __init__(self, out_path: Path, width: int, height: int, fps: float, gpu_id:
563563
)
564564
# NVENC emits an elementary stream; ffmpeg muxes it into a real .mp4.
565565
# To keep source audio, add `-i {src} -map 0:v -map 1:a -c:a aac` here.
566+
# -avoid_negative_ts make_zero is required, not cosmetic: NVENC emits B-frames,
567+
# so frame 0 carries a negative DTS and the mp4 muxer silently drops it (N frames
568+
# in -> N-1 out, output frame 0 == source frame 1).
566569
self._mux = subprocess.Popen(
567570
[
568571
"ffmpeg",
@@ -577,6 +580,8 @@ def __init__(self, out_path: Path, width: int, height: int, fps: float, gpu_id:
577580
"-",
578581
"-c",
579582
"copy",
583+
"-avoid_negative_ts",
584+
"make_zero",
580585
str(out_path),
581586
],
582587
stdin=subprocess.PIPE,

0 commit comments

Comments
 (0)