media: pad from the source's start, fill audio gaps, no wrap
Plan 3 Task 4 fix round 2. The video is cut at an absolute end (trim=end) and the audio filled with silence from 0 and over gaps (aresample async=1:first_pts=0) before apad, so a stream that starts late or an audio gap is no longer charged twice: the reviewer's three sources now charge 5,216, 5,200 and 4,218 ms for 5, 5 and 4 s headers, sync within a frame. Real-binary tests for each. ticksToMicros refuses a quotient at the bound before rounding up, so 2^64-1 us no longer wraps to 0 and is accepted.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
7 files changed,
+157
−22
internal/mediahandler/ffmpeg.go+14 −6internal/mediahandler/ffmpeg_test.go+3 −3internal/mediahandler/fmp4.go+5 −3internal/mediahandler/fmp4_synth_test.go+41 −0internal/mediahandler/fmp4_test.go+3 −0internal/mediahandler/realencode_test.go+90 −9internal/mediahandler/testdata/fmp4/args.txt+1 −1
CI passed — run details
diff --git a/internal/mediahandler/ffmpeg.go b/internal/mediahandler/ffmpeg.go| index bef02baa9..cbbbefd32 100644 |
| --- a/internal/mediahandler/ffmpeg.go |
| +++ b/internal/mediahandler/ffmpeg.go |
| @@ -46,14 +46,18 @@ const ( |
| // chain and operator plan 1 confirms). %d:%d is the output size. |
| // padFilter ends the video encode's chain when the job has audio: the |
| // last frame is repeated, then the video cut at %s, the probed |
| -// duration; padAudio pads the audio with silence to it, and never cuts |
| -// it. Both tracks then last as long as the source (fix 1). |
| +// duration, as an absolute time (trim=end), so a video that starts late |
| +// is not run on past it. padAudio first fills the audio's timeline |
| +// with silence, from 0 and over any gap (aresample async, first_pts), |
| +// so its samples count time, then pads it with silence to the probed |
| +// duration, and never cuts it. Both tracks then last as long as the |
| +// source (fix rounds 1 and 2). |
| const ( |
| sdrFilter = "scale=%d:%d:flags=bicubic,setsar=1,format=yuv420p" |
| hdrFilter = "scale=%d:%d:flags=bicubic,setsar=1,zscale=t=linear:npl=100,format=gbrpf32le,zscale=p=bt709," + |
| "tonemap=tonemap=hable:desat=0,zscale=t=bt709:m=bt709:r=tv,format=yuv420p" |
| - padFilter = ",tpad=stop_mode=clone:stop=-1,trim=duration=%s" |
| - padAudio = "apad=whole_dur=%s" |
| + padFilter = ",tpad=stop_mode=clone:stop=-1,trim=end=%s" |
| + padAudio = "aresample=async=1:first_pts=0,apad=whole_dur=%s" |
| ) |
| // The outputs' names, in media.OutputNames order. |
| @@ -116,8 +120,12 @@ func videoFilter(f probeFacts) string { |
| // With audio, both streams last exactly the probed duration, which is |
| // the longer of the source's streams (its header's, or the longest |
| // taken stream's; plan 3 Task 4 fix 1): the video's last frame is |
| -// repeated (tpad) and cut there (trim), and the audio is padded with |
| -// silence to it (apad whole_dur), never cut. Audio longer than that |
| +// repeated (tpad) and cut there (trim=end), and the audio is filled |
| +// with silence from 0 and over gaps (aresample async) and padded to it |
| +// (apad whole_dur), never cut. Both measure from the source's start, |
| +// not their own stream's, so a stream that starts late or an audio gap |
| +// is not counted twice (fix 2: as trim=duration and a bare apad did, a |
| +// video starting at 2 s under 5 s of audio ran to 7 s). Audio longer than that |
| // (a Matroska with no header duration, where the probe timed the |
| // video's packets) is kept whole, past the video's end, and readFMP4 |
| // counts it; an atrim would drop it. So a short video under long audio |
diff --git a/internal/mediahandler/ffmpeg_test.go b/internal/mediahandler/ffmpeg_test.go| index ede813de6..49ef6e369 100644 |
| --- a/internal/mediahandler/ffmpeg_test.go |
| +++ b/internal/mediahandler/ffmpeg_test.go |
| @@ -109,11 +109,11 @@ func TestVideoArgsSDRLandscape(t *testing.T) { |
| want := append(inputPrefix("mov"), |
| "-map", "0:0", "-map", "0:1", |
| "-sn", "-dn", "-map_metadata", "-1", "-map_chapters", "-1", "-t", "61.500", |
| - "-vf", "scale=1280:720:flags=bicubic,setsar=1,format=yuv420p,tpad=stop_mode=clone:stop=-1,trim=duration=60.000", |
| + "-vf", "scale=1280:720:flags=bicubic,setsar=1,format=yuv420p,tpad=stop_mode=clone:stop=-1,trim=end=60.000", |
| "-c:v", "libx264", "-profile:v", "high", "-preset", "veryfast", "-crf", "23", |
| "-maxrate", "2500k", "-bufsize", "5000k", "-pix_fmt", "yuv420p", "-fpsmax", "30", |
| "-force_key_frames", "expr:gte(t,n_forced*2)", "-sc_threshold", "0", |
| - "-c:a", "aac", "-b:a", "128k", "-ac", "2", "-ar", "48000", "-af", "apad=whole_dur=60.000", |
| + "-c:a", "aac", "-b:a", "128k", "-ac", "2", "-ar", "48000", "-af", "aresample=async=1:first_pts=0,apad=whole_dur=60.000", |
| "-f", "mp4", "-movflags", "+frag_keyframe+empty_moov+default_base_moof+skip_trailer", |
| "-min_frag_duration", "4000000", "/scratch/out/video.mp4") |
| if !slices.Equal(got, want) { |
| @@ -148,7 +148,7 @@ func TestVideoArgsPortraitHDR(t *testing.T) { |
| args []string |
| want string |
| }{ |
| - "video": {videoArgs(cfg, f, videoPayload(60000), "mov"), hdr + ",tpad=stop_mode=clone:stop=-1,trim=duration=" + msSeconds(f.DurationMS)}, |
| + "video": {videoArgs(cfg, f, videoPayload(60000), "mov"), hdr + ",tpad=stop_mode=clone:stop=-1,trim=end=" + msSeconds(f.DurationMS)}, |
| "poster": {posterArgs(cfg, f, videoPayload(60000), "mov"), hdr}, |
| } { |
| if vf := argAfter(c.args, "-vf"); vf != c.want { |
diff --git a/internal/mediahandler/fmp4.go b/internal/mediahandler/fmp4.go| index 8c842c03d..1bd9c7922 100644 |
| --- a/internal/mediahandler/fmp4.go |
| +++ b/internal/mediahandler/fmp4.go |
| @@ -127,12 +127,14 @@ func ticksToMicros(ticks uint64, timescale uint32, up bool) (int64, error) { |
| return 0, errors.New("the duration is implausible") |
| } |
| q, r := bits.Div64(hi, lo, ts) |
| + // Refused before the round-up, which could otherwise wrap a |
| + // quotient of 2^64-1 to 0 (fix 2). |
| + if q >= uint64(maxDurationMS)*1000 { |
| + return 0, errors.New("the duration is implausible") |
| + } |
| if up && r > 0 { |
| q++ |
| } |
| - if q > uint64(maxDurationMS)*1000 { |
| - return 0, errors.New("the duration is implausible") |
| - } |
| return int64(q), nil |
| } |
diff --git a/internal/mediahandler/fmp4_synth_test.go b/internal/mediahandler/fmp4_synth_test.go| index f9787e270..73bf85daf 100644 |
| --- a/internal/mediahandler/fmp4_synth_test.go |
| +++ b/internal/mediahandler/fmp4_synth_test.go |
| @@ -315,6 +315,8 @@ func TestReadFMP4SyntheticRefusals(t *testing.T) { |
| f.tracks = append(f.tracks, sTrack{id: 2, handler: "soun", timescale: 48000, noTrex: true}) |
| f.frags[1] = append(f.frags[1], sTraf{track: 2, tfdt: 48000, truns: []sTrun{{flags: trunSampleSize, sizes: []uint32{1}}}}) |
| }, want: "no sample duration"}, |
| + // A round-up that would wrap 2^64-1 µs to 0 (fix 2). |
| + "a round-up that wraps": {edit: wrapSynth, want: "implausible"}, |
| // 2e15 ticks of 1,000 is 2e18 µs: under 2^64, over the bound. |
| "a tfdt past the bound": {edit: func(f *sFile) { f.frags[2][0].tfdt = 2e15 }, want: "implausible"}, |
| "two trafs for it": {edit: func(f *sFile) { f.frags[1] = append(f.frags[1], f.frags[1][0]) }, want: "two trafs"}, |
| @@ -446,3 +448,42 @@ func growChild(b []byte, typ string, n uint32) []byte { |
| binary.BigEndian.PutUint32(b[at:], binary.BigEndian.Uint32(b[at:])+n) |
| return b |
| } |
| + |
| +// wrapSynth makes the last fragment end at 23,408,918,229,537,421 |
| +// ticks of 1,269: 2^64-1 µs and a remainder, which a round-up after the |
| +// bound check wrapped to 0 (fix 2's reviewer case). |
| +func wrapSynth(f *sFile) { |
| + f.tracks[0].timescale = 1269 |
| + f.frags[1][0].tfdt = 4 * 1269 |
| + f.frags[2][0].tfdt = 23408918229537421 - 2 |
| + f.frags[2][0].truns[0].durs = []uint32{1, 1} |
| +} |
| + |
| +// TestTicksToMicros: rounded up or down, in 128-bit arithmetic; a |
| +// quotient at or past the bound is refused before any round-up, so |
| +// nothing wraps. |
| +func TestTicksToMicros(t *testing.T) { |
| + bound := uint64(maxDurationMS) * 1000 |
| + for _, c := range []struct { |
| + ticks uint64 |
| + ts uint32 |
| + up bool |
| + want int64 |
| + err bool |
| + }{ |
| + {1269, 1269, true, 1_000_000, false}, |
| + {1, 3, true, 333_334, false}, |
| + {1, 3, false, 333_333, false}, |
| + {0, 1000, true, 0, false}, |
| + {23408918229537421, 1269, true, 0, true}, // q = 2^64-1, r > 0: wrapped to 0 |
| + {23408918229537421, 1269, false, 0, true}, // past the bound either way |
| + {bound, 1_000_000, false, 0, true}, // exactly the bound |
| + {bound - 1, 1_000_000, true, int64(bound - 1), false}, |
| + {math.MaxUint64, 1, false, 0, true}, // over 2^64 µs |
| + } { |
| + got, err := ticksToMicros(c.ticks, c.ts, c.up) |
| + if got != c.want || (err != nil) != c.err { |
| + t.Errorf("%d ticks of %d, up %v: %d, %v", c.ticks, c.ts, c.up, got, err) |
| + } |
| + } |
| +} |
diff --git a/internal/mediahandler/fmp4_test.go b/internal/mediahandler/fmp4_test.go| index a77cb7e58..ebf0fb15d 100644 |
| --- a/internal/mediahandler/fmp4_test.go |
| +++ b/internal/mediahandler/fmp4_test.go |
| @@ -444,6 +444,9 @@ func FuzzReadFMP4(f *testing.F) { |
| f.Add(b[:len(b)/2]) |
| } |
| f.Add(goodSynth().bytes()) |
| + wrap := goodSynth() |
| + wrapSynth(&wrap) |
| + f.Add(wrap.bytes()) |
| f.Add([]byte{}) |
| f.Add([]byte("\x00\x00\x00\x08ftyp\x00\x00\x00\x08moov")) |
| f.Fuzz(func(t *testing.T, b []byte) { |
diff --git a/internal/mediahandler/realencode_test.go b/internal/mediahandler/realencode_test.go| index 2178f27f8..701b3e4a1 100644 |
| --- a/internal/mediahandler/realencode_test.go |
| +++ b/internal/mediahandler/realencode_test.go |
| @@ -10,6 +10,7 @@ import ( |
| "maps" |
| "math" |
| "os" |
| + "os/exec" |
| "path/filepath" |
| "slices" |
| "strconv" |
| @@ -51,6 +52,21 @@ func init() { |
| // A video (6 s) longer than its audio (2 s): not cut to the audio. |
| "long-video-short-audio": {"mov", media.PresetVideo720p, |
| "-f lavfi -i testsrc=size=160x90:rate=10:d=6 -f lavfi -i sine=d=2 -c:v libx264 -preset ultrafast -c:a aac -f mp4 OUT", false}, |
| + // Offsets and gaps (fix 2). Each has a sync anchor at 3 s, 2 s |
| + // and 3 s: the video turns from black to white, and the audio |
| + // from silence to a tone, at the same source time. |
| + // A video that starts at 2 s (3 s of it) under 5 s of audio. |
| + "video-starts-late": {"mov", media.PresetVideo720p, |
| + "-itsoffset 2 -f lavfi -i color=c=white:s=160x90:r=10:d=3,drawbox=w=iw:h=ih:color=black:t=fill:enable=lt(t\\,1) " + |
| + "-f lavfi -i sine=d=5,volume=0:enable=lt(t\\,3) -map 0:v -map 1:a -c:v libx264 -preset ultrafast -c:a aac -f mp4 OUT", false}, |
| + // 5 s of video, 1 s of audio starting at 2 s. |
| + "audio-starts-late": {"mov", media.PresetVideo720p, |
| + "-f lavfi -i color=c=white:s=160x90:r=10:d=5,drawbox=w=iw:h=ih:color=black:t=fill:enable=lt(t\\,2) " + |
| + "-itsoffset 2 -f lavfi -i sine=d=1 -map 0:v -map 1:a -c:v libx264 -preset ultrafast -c:a aac -f mp4 OUT", false}, |
| + // 4 s of video, audio with a gap from 1 s to 3 s. |
| + "audio-gap": {"mov", media.PresetVideo720p, |
| + "-f lavfi -i color=c=white:s=160x90:r=10:d=4,drawbox=w=iw:h=ih:color=black:t=fill:enable=lt(t\\,3) " + |
| + "-f lavfi -i sine=d=4 -map 0:v -map 1:a -af aselect=not(between(t\\,1\\,3)) -c:v libx264 -preset ultrafast -c:a aac -f mp4 OUT", false}, |
| // Anamorphic: 720x480 stored, 4:3 pixels, shown 960x480 (fix 1). |
| "anamorphic-4-3": {"mov", media.PresetVideo720p, |
| "-f lavfi -i testsrc=size=720x480:rate=10:d=1 -vf setsar=4/3 -c:v libx264 -preset ultrafast -f mp4 OUT", false}, |
| @@ -271,18 +287,25 @@ func TestRealVideoEncodes(t *testing.T) { |
| lengthMS int64 |
| frame float64 |
| videoMS int64 |
| + // anchorMS, when set, is the source time at which the video |
| + // turns from black to white and the audio from silence to a |
| + // tone (fix 2's sync check). |
| + anchorMS int64 |
| }{ |
| - {"h264-1080p", 1280, 720, true, false, 2500, 1.0 / 30, 0}, |
| - {"iphone-hevc-hlg-portrait", 720, 1280, true, true, 1000, 1.0 / 30, 0}, |
| - {"hevc-pq", 1280, 720, false, true, 1000, 1.0 / 30, 0}, |
| - {"vfr-screen-recording", 640, 400, false, false, 2000, 1.0 / 15, 0}, |
| - {"fixture-video", 160, 90, false, false, 10000, 1.0 / 30, 0}, |
| - {"short-video-long-audio", 160, 90, true, false, 9000, 1.0 / 10, 0}, |
| - {"long-video-short-audio", 160, 90, true, false, 6000, 1.0 / 10, 0}, |
| - {"anamorphic-4-3", 960, 480, false, false, 1000, 1.0 / 10, 0}, |
| + {"h264-1080p", 1280, 720, true, false, 2500, 1.0 / 30, 0, 0}, |
| + {"iphone-hevc-hlg-portrait", 720, 1280, true, true, 1000, 1.0 / 30, 0, 0}, |
| + {"hevc-pq", 1280, 720, false, true, 1000, 1.0 / 30, 0, 0}, |
| + {"vfr-screen-recording", 640, 400, false, false, 2000, 1.0 / 15, 0, 0}, |
| + {"fixture-video", 160, 90, false, false, 10000, 1.0 / 30, 0, 0}, |
| + {"short-video-long-audio", 160, 90, true, false, 9000, 1.0 / 10, 0, 0}, |
| + {"long-video-short-audio", 160, 90, true, false, 6000, 1.0 / 10, 0, 0}, |
| + {"anamorphic-4-3", 960, 480, false, false, 1000, 1.0 / 10, 0, 0}, |
| + {"video-starts-late", 160, 90, true, false, 5000, 1.0 / 10, 0, 3000}, |
| + {"audio-starts-late", 160, 90, true, false, 5000, 1.0 / 10, 0, 2000}, |
| + {"audio-gap", 160, 90, true, false, 4000, 1.0 / 10, 0, 3000}, |
| // No header duration: the probe times the video's packets (1 s), |
| // and the audio (3 s) is kept whole past it, not cut (fix 1). |
| - {"av-no-duration", 160, 90, true, false, 3000, 1.0 / 10, 1000}, |
| + {"av-no-duration", 160, 90, true, false, 3000, 1.0 / 10, 1000, 0}, |
| } { |
| t.Run(c.name, func(t *testing.T) { |
| f, p := realEncode(t, cfg, c.name, media.PresetVideo720p, 0) |
| @@ -346,6 +369,20 @@ func TestRealVideoEncodes(t *testing.T) { |
| if got := float64(durationMS) / 1000; got < float64(c.lengthMS)/1000-c.frame || got > float64(c.lengthMS)/1000+2*c.frame+priming+0.001 { |
| t.Errorf("duration %d ms, want %d ms within a frame", durationMS, c.lengthMS) |
| } |
| + if c.anchorMS > 0 { |
| + // Sync: the cut and the onset land together, each at the |
| + // anchor plus at most the muxer's two-frame start delay. |
| + anchor := float64(c.anchorMS) / 1000 |
| + vt, at := whiteFrom(t, cfg, outPath(cfg, "video.mp4")), firstOnset(t, cfg, outPath(cfg, "video.mp4")) |
| + if math.Abs(vt-at) > c.frame+0.03 { |
| + t.Errorf("out of sync: the video cuts at %.3f s, the audio starts at %.3f s", vt, at) |
| + } |
| + for what, v := range map[string]float64{"video cut": vt, "audio onset": at} { |
| + if v < anchor-c.frame || v > anchor+2*c.frame+0.03 { |
| + t.Errorf("%s at %.3f s, want %.3f s plus the muxer delay", what, v, anchor) |
| + } |
| + } |
| + } |
| pl, err := os.ReadFile(outPath(cfg, "video.m3u8")) |
| if err != nil { |
| t.Fatal(err) |
| @@ -426,3 +463,47 @@ func TestRealAudioEncodes(t *testing.T) { |
| }) |
| } |
| } |
| + |
| +// ffmpegInfo runs the real ffmpeg directly at -loglevel info and |
| +// answers its stderr (where silencedetect and metadata=print write). |
| +func ffmpegInfo(t *testing.T, cfg Config, args ...string) string { |
| + t.Helper() |
| + cmd := exec.Command(cfg.FFmpeg, append([]string{"-hide_banner", "-nostdin", "-loglevel", "info"}, args...)...) |
| + var stderr bytes.Buffer |
| + cmd.Stderr = &stderr |
| + if err := cmd.Run(); err != nil { |
| + t.Fatalf("ffmpeg %v: %v\n%s", args, err, stderr.String()) |
| + } |
| + return stderr.String() |
| +} |
| + |
| +// firstOnset is the time the audio of path first turns from silence |
| +// to sound (silencedetect's first silence_end; a silence running to |
| +// the end of the stream also ends there, so not the last). |
| +func firstOnset(t *testing.T, cfg Config, path string) float64 { |
| + t.Helper() |
| + out := ffmpegInfo(t, cfg, "-i", path, "-map", "0:a", "-af", "silencedetect=n=-40dB:d=0.3", "-f", "null", "-") |
| + i := strings.Index(out, "silence_end: ") |
| + if i < 0 { |
| + t.Fatalf("no silence ends in %s", path) |
| + } |
| + return parseFloat(t, strings.Fields(out[i+len("silence_end: "):])[0]) |
| +} |
| + |
| +// whiteFrom is the presentation time of the first frame of path whose |
| +// mean luma is over half. |
| +func whiteFrom(t *testing.T, cfg Config, path string) float64 { |
| + t.Helper() |
| + out := ffmpegInfo(t, cfg, "-i", path, "-map", "0:v", "-vf", "signalstats,metadata=print:key=lavfi.signalstats.YAVG", "-f", "null", "-") |
| + pts := -1.0 |
| + for _, l := range strings.Split(out, "\n") { |
| + if i := strings.Index(l, "pts_time:"); i >= 0 { |
| + pts = parseFloat(t, strings.Fields(l[i+len("pts_time:"):])[0]) |
| + } |
| + if i := strings.Index(l, "YAVG="); i >= 0 && pts >= 0 && parseFloat(t, strings.TrimSpace(l[i+len("YAVG="):])) > 128 { |
| + return pts |
| + } |
| + } |
| + t.Fatalf("no white frame in %s", path) |
| + return 0 |
| +} |
diff --git a/internal/mediahandler/testdata/fmp4/args.txt b/internal/mediahandler/testdata/fmp4/args.txt| index 6c7cfc6d8..dc04e2784 100644 |
| --- a/internal/mediahandler/testdata/fmp4/args.txt |
| +++ b/internal/mediahandler/testdata/fmp4/args.txt |
| @@ -1,4 +1,4 @@ |
| # ffmpeg version 7.1.5-0+deb13u1 Copyright (c) 2000-2026 the FFmpeg developers |
| -{"file":"video.mp4","args":["-hide_banner","-nostats","-loglevel","error","-nostdin","-protocol_whitelist","file","-f","mov","-enable_drefs","0","-max_pixels","16777216","-codec_whitelist","h264,hevc,vp8,vp9,av1,libdav1d,aac,opus,libopus,vorbis,libvorbis,mp3,mp3float,flac,pcm_u8,pcm_s16le,pcm_s16be,pcm_s24le,pcm_s24be,pcm_s32le,pcm_s32be,pcm_f32le,pcm_f32be,pcm_f64le,pcm_f64be,pcm_alaw,pcm_mulaw","-i","<scratch>/in/source","-map","0:0","-map","0:1","-sn","-dn","-map_metadata","-1","-map_chapters","-1","-t","9.000","-vf","scale=160:90:flags=bicubic,setsar=1,format=yuv420p,tpad=stop_mode=clone:stop=-1,trim=duration=9.000","-c:v","libx264","-profile:v","high","-preset","veryfast","-crf","23","-maxrate","2500k","-bufsize","5000k","-pix_fmt","yuv420p","-fpsmax","30","-force_key_frames","expr:gte(t,n_forced*2)","-sc_threshold","0","-c:a","aac","-b:a","128k","-ac","2","-ar","48000","-af","apad=whole_dur=9.000","-f","mp4","-movflags","+frag_keyframe+empty_moov+default_base_moof+skip_trailer","-min_frag_duration","4000000","<scratch>/out/video.mp4"]} |
| +{"file":"video.mp4","args":["-hide_banner","-nostats","-loglevel","error","-nostdin","-protocol_whitelist","file","-f","mov","-enable_drefs","0","-max_pixels","16777216","-codec_whitelist","h264,hevc,vp8,vp9,av1,libdav1d,aac,opus,libopus,vorbis,libvorbis,mp3,mp3float,flac,pcm_u8,pcm_s16le,pcm_s16be,pcm_s24le,pcm_s24be,pcm_s32le,pcm_s32be,pcm_f32le,pcm_f32be,pcm_f64le,pcm_f64be,pcm_alaw,pcm_mulaw","-i","<scratch>/in/source","-map","0:0","-map","0:1","-sn","-dn","-map_metadata","-1","-map_chapters","-1","-t","9.000","-vf","scale=160:90:flags=bicubic,setsar=1,format=yuv420p,tpad=stop_mode=clone:stop=-1,trim=end=9.000","-c:v","libx264","-profile:v","high","-preset","veryfast","-crf","23","-maxrate","2500k","-bufsize","5000k","-pix_fmt","yuv420p","-fpsmax","30","-force_key_frames","expr:gte(t,n_forced*2)","-sc_threshold","0","-c:a","aac","-b:a","128k","-ac","2","-ar","48000","-af","aresample=async=1:first_pts=0,apad=whole_dur=9.000","-f","mp4","-movflags","+frag_keyframe+empty_moov+default_base_moof+skip_trailer","-min_frag_duration","4000000","<scratch>/out/video.mp4"]} |
| {"file":"video-noaudio.mp4","args":["-hide_banner","-nostats","-loglevel","error","-nostdin","-protocol_whitelist","file","-f","mov","-enable_drefs","0","-max_pixels","16777216","-codec_whitelist","h264,hevc,vp8,vp9,av1,libdav1d,aac,opus,libopus,vorbis,libvorbis,mp3,mp3float,flac,pcm_u8,pcm_s16le,pcm_s16be,pcm_s24le,pcm_s24be,pcm_s32le,pcm_s32be,pcm_f32le,pcm_f32be,pcm_f64le,pcm_f64be,pcm_alaw,pcm_mulaw","-i","<scratch>/in/source","-map","0:0","-sn","-dn","-map_metadata","-1","-map_chapters","-1","-t","9.000","-vf","scale=160:90:flags=bicubic,setsar=1,format=yuv420p","-c:v","libx264","-profile:v","high","-preset","veryfast","-crf","23","-maxrate","2500k","-bufsize","5000k","-pix_fmt","yuv420p","-fpsmax","30","-force_key_frames","expr:gte(t,n_forced*2)","-sc_threshold","0","-an","-f","mp4","-movflags","+frag_keyframe+empty_moov+default_base_moof+skip_trailer","-min_frag_duration","4000000","<scratch>/out/video.mp4"]} |
| {"file":"audio.mp4","args":["-hide_banner","-nostats","-loglevel","error","-nostdin","-protocol_whitelist","file","-f","wav","-max_pixels","16777216","-codec_whitelist","h264,hevc,vp8,vp9,av1,libdav1d,aac,opus,libopus,vorbis,libvorbis,mp3,mp3float,flac,pcm_u8,pcm_s16le,pcm_s16be,pcm_s24le,pcm_s24be,pcm_s32le,pcm_s32be,pcm_f32le,pcm_f32be,pcm_f64le,pcm_f64be,pcm_alaw,pcm_mulaw","-i","<scratch>/in/source","-map","0:0","-vn","-sn","-dn","-map_metadata","-1","-map_chapters","-1","-t","9.000","-af","aformat=channel_layouts=stereo:sample_rates=48000,volume=0.00dB","-c:a","aac","-b:a","128k","-f","mp4","-movflags","+empty_moov+default_base_moof+skip_trailer","-frag_duration","4000000","<scratch>/out/audio.mp4"]} |