[FFmpeg-user] Carrying arbitrary data track from TS to mp4
Sid Sethupathi
sid.sethupathi at gmail.com
Fri Jan 5 16:49:25 EET 2024
Hello,
I have an MPEG-TS video that has some arbitrary data included in a data
stream. The data doesn't fit any typical media spec, it is some camera
calibration data. Here is a sample:
https://drive.google.com/file/d/1k-p3oLEJ_Ot5My4TEo9B7hWv3hwHijLJ/view?usp=sharing
You can extract the data using the following command: "ffmpeg -i sample.ts
-map d:0 -f data ts.bin" or you can do a cursory inspection with hexdump:
"ffmpeg -hide_banner -loglevel error -i sample.ts -map d:0 -c copy -f data
- | hexdump | less"
I'd like to convert this file to an mp4 and retain the arbitrary data track.
The following command seems to work:
"ffmpeg -i sample.ts -map 0 sample.mp4"
but upon closer inspection, the data track includes some data but appears
to have been truncated, I think to just the first frame. The extracted
binary data from the TS sample is 206K, but from the MP4 sample it is 170B.
If you compare the extracted binary in hexdump, the MP4 sample stops after
the first repeated xFF separator which is what is leading me to believe it
is stopping after the first frame.
I'm unsure whether this is a limitation with the MP4 container, or if I'm
missing a flag somewhere in the ffmpeg invocation, so any guidance would be
appreciated.
Thanks,
Sid
More information about the ffmpeg-user
mailing list