Does This 15s 9:16 Fixture Have B-frames? Parse stss and ctts, Then Re-encode With -bf 0
Does This 15s 9:16 Fixture Have B-frames? Parse stss and ctts, Then Re-encode With -bf 0
A 15-second 9:16 clip can play fine and still carry B-frames. The useful checks are ffprobe's has_b_frames flag, a pict_type count, the ISO-BMFF stss (sync sample) table, and the ctts (composition offset) table, which is how an MP4 stores CTS−DTS reordering. I walked a synthetic 720×1280, 15.000000 s, High profile level 31, 48 kHz AAC-LC fixture generated on this box with ffmpeg 7.1.5 (CRF 23, -g 48, movflags +faststart). No paid Hit the Road Dude render is in this set; the file is a constructed 15-second 9:16 fixture in the product format. The helper is bframes.py; pytest pins the figures below.
The fixture does have B-frames
source_15s_916.mp4 is 5,264,872 bytes. ffprobe reports has_b_frames=2. There are 360 video frames: 8 I, 151 P, and 201 B. Every I-frame is an IDR (all eight have key_frame=1); there are zero non-IDR I-frames. The longest run of B-frames is 3. GOP lengths are seven times 48 frames, then a final 24-frame GOP. The first GOP's pict_type pattern is:
IBBBPBPBBPBBBPBBBPBBBPBBBPBPBBBPBBBPBBBPBBBPBBBP
The stss box sits at offset 658, size 48, with 8 sync samples, 1-indexed: 1, 49, 97, 145, 193, 241, 289, 337. That is one IDR every 48 frames, matching -g 48.
A ctts box is present: version 0, offset 706, size 2,280, 283 entries covering all 360 samples. 322 of those samples have a nonzero composition offset. The unique offsets are 0, 512, 1,024, 1,536, 2,048, 2,560. The stts table is a single entry: 360 samples at delta 512. The video timescale is 12,288, and 12,288 / 24 = 512, so those offsets are 0 through 5 frames.
This is a different question from keyframe spacing. The 48-frame GOP is expected from the encode recipe; the B-frames and the ctts box are what this note is about, and they are present on this constructed fixture.
A stream copy keeps the B-frames
ffmpeg -c copy -movflags +faststart produced streamcopy.mp4, still 5,264,872 bytes, still has_b_frames=2, still 201 B-frames, with the same stss sample numbers and the same 283-entry ctts table. A remux does not drop B-frames.
-bf 0 removes ctts, and a later stream copy keeps that
A documented libx264 re-encode, same High@L3.1, CRF 23, -g 48, audio copied, plus -bf 0:
ffmpeg -i source_15s_916.mp4 \ -c:v libx264 -profile:v high -level 3.1 -crf 23 -preset medium \ -g 48 -keyint_min 48 -bf 0 -c:a copy -movflags +faststart bf0.mp4 wrote bf0.mp4 at 4,943,118 bytes. has_b_frames is 0. The pict_type counts are 8 I, 352 P, and 0 B. The first GOP is one I followed by 47 P-frames. The ctts box is gone. The stss table still has the same 8 sync samples at the same numbers, so the GOP interval did not have to change.
A stream copy of that file (-c copy -movflags +faststart) stays at 4,943,118 bytes, still with has_b_frames=0, 0 B-frames, and no ctts. The no-B-frame result survives. The two files are not bitwise identical: 3 bytes differ, at offsets 629–631. A later remux keeps the bitstream shape; it is not a promise of a byte-for-byte copy.
python3 src/bframes.py files/source/source_15s_916.mp4 python3 -m pytest src/test_bframes.py The studio at hittheroaddude.app sells one 15-second vertical clip from one photo, with a newly generated voice and no prompt box. I re-checked the pricing page on 3 December 2026 between 09:22:35 and 09:22:41 Asia/Shanghai: $9.99 / 6 credits at 480p, $12.99 / 14 credits at 720p. There is no subscription and no free clip.