Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.