DEV Community

Peiguan
Peiguan

Posted on

How Do You Attach a Poster Frame to a Hit the Road Dude Clip Without Re-encoding, and Does a Stream Copy Keep It?

How Do You Attach a Poster Frame to a Hit the Road Dude Clip Without Re-encoding, and Does a Stream Copy Keep It?

A 15-second 9:16 clip needs a poster if you are embedding it on a page, sending it to a desktop player that shows a cover, or handing someone a file they will not play until they see a still. MP4 can carry that still as an attached_pic (a Motion-JPEG video stream with the attached-picture disposition). I generated the controls on this box today with ffmpeg 7.1.5 and libx264. No paid Hit the Road Dude render is in this set; the source is a synthetic 720×1280, 15.000000 s, High profile level 31, 48 kHz AAC-LC fixture with movflags +faststart, so the numbers can be checked.

The source has no cover

source_15s_916.mp4 is 5,264,872 bytes. It has two streams: H.264 video (360 frames, handler VideoHandler) and AAC-LC audio (705 frames, SoundHandler). The container encoder tag is Lavf61.7.103. The moov atom starts at byte 32 and the mdat at byte 11,272, so the file is already faststart. ffprobe reports no chapters and no attached picture.

A mid-clip still at t=7.0 s, saved as JPEG, is 61,551 bytes, 720×1280, yuvj420p, full (pc) range.

Re-encoding the JPEG is not a copy

Muxing that JPEG with -c copy -c:v:1 mjpeg -disposition:v:1 attached_pic produced with_cover_jpg.mp4 at 5,305,067 bytes — 40,195 bytes larger, not 61,551. The file now has three streams. Stream 2 is MJPEG, 720×1280, attached_pic=1, default=0. Extracting that stream with -map 0:v:1 -c copy wrote 40,171 bytes, and the bytes are not the original JPEG (different MD5). -c:v:1 mjpeg re-encoded the still. The 24 leftover bytes are container overhead around the new picture.

A PNG poster (198,145 bytes) went through the same MJPEG re-encode and landed at 5,324,616 bytes.

-c:v:1 copy keeps the original JPEG

The same mux with -c:v:1 copy (and the same attached-picture disposition) produced with_cover_jpg_streamcopy_in.mp4 at 5,326,447 bytes. That is 61,575 bytes larger than the source — the 61,551-byte JPEG plus 24 bytes of boxes. Extracting stream 2 now yields 61,551 bytes, bitwise identical to the poster.

A bare ffmpeg -c copy drops the cover

Copying with_cover_jpg.mp4 with ffmpeg -c copy -movflags +faststart and no -map produced a 5,264,872-byte file with two streams — the original source, cover gone. ffmpeg's default stream map skips attached pictures.

Copying the same file with -map 0 -c copy -movflags +faststart kept all three streams and the same 5,305,067 bytes. If you want the poster to survive a remux, map it.

Skipping attached_pic makes a second video, not a cover

Muxing the JPEG without -disposition:v:1 attached_pic produced cover_without_disposition.mp4 at 5,305,624 bytes. Stream 2 is still MJPEG 720×1280, but attached_pic=0, duration 0.040000 s, 1 frame, and it has a VideoHandler tag. A player can treat that as a second, almost empty video — not a poster. The disposition bit is the difference.

If you are preparing a Hit the Road Dude download for a page or a folder of clips, attach a mid-clip still with -c:v:1 copy and attached_pic, then remux with -map 0. A default stream copy will strip the picture you just added.

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 1 December 2026 between 09:18:59 and 09:26:35 Asia/Shanghai: $9.99 / 6 credits at 480p, $12.99 / 14 credits at 720p. There is no subscription and no free clip.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

This is the kind of post where the numbers do the arguing. The finding that matters most is the silent one: a bare ffmpeg -c copy hands you back a file that is byte-for-byte the size of the source — 5,264,872 bytes — so nothing looks wrong until you probe and find the cover is gone. No error, no warning, just a poster that was never there. That is a much nastier failure than the re-encode case, where at least the MD5 tells you something changed.

The 24-byte overhead showing up identically in both the mjpeg and the stream-copy runs is a nice fingerprint too — it makes the +61,575 vs +40,195 difference easy to sanity-check at a glance.

One gap I would love to see closed: the mux is only half the story. Do the players you are embedding for actually honor attached_pic, or do some of them ignore the disposition and show frame 0 anyway? Have you checked which of the desktop players you target pick up the cover, and which just treat it as a third stream?