1
Suppose I have a private media stream (neither audio nor video nor subtitles) and I want to mux that into an MP4 or MPEG2TS file with ffmpeg. Is it possible without source changes? Or do I have a write a codec for ffmpeg?
1
Suppose I have a private media stream (neither audio nor video nor subtitles) and I want to mux that into an MP4 or MPEG2TS file with ffmpeg. Is it possible without source changes? Or do I have a write a codec for ffmpeg?
2
There is a well-implemented library called MP4v2
suitable for use in C/C++ that provides enough functionality for the stated purpose. In particular, one can add a track to an MP4 and set all the box types within the file to suit one's needs. Similarly, the library will extract tracks to another file, and delete an existing track from a file.
For the MPEG2TS part, I have not found any similar library and have decided to write a program that manipulates the .ts
files directly by muxing in new packets under a new PID with PTS sync'ed to the audio/video streams.
None of this will use ffmpeg. Although I spent substantial time trying to understand this (comprehensive and vast) tool, it appears I would have to write a codec for my new stream type and this is quite a bit of work.
Do you know the syntax for adding and removing streams from an existing M4V? Or a link to docs showing so. Thanks. – Gyan – 2015-10-20T14:21:16.683
I believe
ffmpeg
really only treats video, audio and subtitle streams, but have you tried a simple bitstream copy (-c copy -map 0
)? What doesffmpeg
identify your streams as? What is the actual goal, or where does the stream come from? Maybe there are more specialized tools available that do the job for you… – slhck – 2013-07-05T08:59:35.837Thanks for the reply, @slhck. After some research, I believe that I would have to write a codec for
ffmpeg
to handle a new media type; this is some work, but doable. ButMP4v2
provides a nice api for MP4 files and I've decided to use that instead (for the MP4 piece of this project). – Fixee – 2013-07-05T15:33:25.010