Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
I believe ffmpeg really only treats video, audio and subtitle streams, but have you tried a simple bitstream copy (-c copy -map 0)? What does ffmpeg 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 Jul 5 '13 at 8:59
Thanks 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. But MP4v2 provides a nice api for MP4 files and I've decided to use that instead (for the MP4 piece of this project). – Fixee Jul 5 '13 at 15:33

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.

share|improve this answer
Do you know the syntax for adding and removing streams from an existing M4V? Or a link to docs showing so. Thanks. – Mulvya Oct 20 '15 at 14:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .