Is there a way to make FFmpeg create data streams in MP4 or Quicktime (.mov) containers? I have tried -attach ...
(works fine for Matroska containers, but not MP4/MOV) or -codec bin_data
, but to no avail.
-attach ...
technically creates streams with codec type "attachment", which are different from data streams. And while FFmpeg isn't smart enough to directly create data streams in containers where attachment streams aren't supported (ie. MP4), a two-step approach works:
ffmpeg -i <some media file> -attach <some data file> -metadata:s:2 mimetype=<data MIME type> -map 0:v -map 0:a -codec copy attached.mkv
ffmpeg -i attached.mkv -codec copy attached.mp4
The first command creates a Matroska file that contains a stream with codec_type=attachment
. The second command then simply re-packages this into an MP4 container, turning the attachment stream into a data stream (codec_type=data
). So the question is: could this be combined into a single step?
try