I am reading in an mp4 file which I can demux. The file contains h264 video stream. I want to be able to wrap the h264 video stream in mpeg2 ts such that I can pass it onto other parts of the system as mpeg2 ts or even writing it into a new file as mpeg2 ts.
Any pointers would be appreciated.
Thanks,
I recommend FFMPEG for this task. Here are some example uses for format conversions
tsMuxeR was built for this purpose.
If you have troubles with that tool, try TsRemux.
Related
I'm doing some integration work with video (H.264) and audio (AAC) from an IP camera.
I've made a bit of progress and I can store the video & audio streams individually with the ability to play it back using VLC player. The H.264 is being stored in Annex B format and the audio is using an adts formatted file.
I'm now trying to mux the streams into an MP4 file without doing any decoding or encoding but so far haven't managed to find the answer.
I can do this manually with ffmpeg:
ffmpeg -i recording.h264 -i recording.aac -vcodec copy -acodec copy -absf aac_adtstoasc recording.mp4
How do I do this with the ffmpeg library from C++?
Check out the muxing sample; the key is to keep track of your audio/video timestamps and write the next one in time using av_interleaved_write_frame.
I'm trying to use FFMpeg to create a video. So far i've been playing with a multiplexing example:
http://ffmpeg.org/doxygen/trunk/muxing_8c-source.html, and i'm able to create a compressed video from an already existing video.
Because my program is going to run on an embedded platform I would like to use some custom code (generated by a colleague) to compress the video data and place it into the video file.
So I'm looking for a way to create a video file in c/c++ using ffmpeg in which i have full control over the compression part (to basically circumvent ffmpeg from doing the compression for me and inserting my own code).
To clarify i'm planning to use this to save film from an intelligent camera into a compressed h264 mpeg-4 file.
You could pipe the output with -vcodec rawvideo to your custom program, or write it as a codec and have ffmpeg handle it.
By the way, ffmpeg was superceded by avconv. ffmpeg only exists for backwards compatibility now.
Edit: apparently avconv is a newer fork of ffmpeg, and seems to have more support. Either way, the options are almost the same.
Any Idea what demuxer should be used for mp3 ? I trying to implement hello world program for playing an mp3.
mp3 streams are usually not muxed. You will use a bitstream parser (such as mp3parse) and then a mp3decoder (such as mad).
I'm working in an app in wich we use IMediaDet to get stream lengths. Now we're starting to work with MP4 containers. The problem is, when I try an IMediaDet::put_fileName() with the MP4 file, I get HRESULT = -2147024770 (ERROR_MOD_NOT_FOUND). Using a comercial mp4 demuxer, I see the video stream uses mpg2 encoding.
My questions: How to get the stream length of a stream inside a MP4 container? Is there a way to make IMediaDet accept these files? Is there a way to point what demuxer IMediaDet should use?
Any help would be much appreciated.
Thanks.
Unfortunately, DirectShow does not contain an MP4 parser, even in Windows 7. In Win7, the MP4 functionality was added to media foundation.
So you have a few options. You can buy or build a directshow filter that implements an MP4 demux and associate it with the "mp4" file extension, which should allow IMediaDet to properly demux the file. Or you can use Media Foundation, which should be able to return this info. Or you could use a separate library entirely for MP4 files, like MP4v2. (note you could also implement an MP4 demux filter with MP4v2, if you want to use DirectShow instead of MP4v2 directly)
I'm looking for a way to extract the audio part of a FLV file.
I'm recording from the user's microphone and the audio is encoded using the Nellymoser Asao Codec. This is the default codec and there's no way to change this.
ffMpeg is the way to go !
It worked for me with SVN Rev 14277.
The command I used is : ffmpeg -i source.flv -nv -f mp3 destination.mp3
GOTCHA :
If you get this error message : Unsupported audio codec (n),
check the FLV Spec in the Audio Tags section.
ffMpeg can decode n=6 (Nellymoser).
But for n=4 (Nellymoser 8-kHz mono) and n=5 (Nellymoser 16-kHz mono) it doesn't work.
To fix this use the default microphone rate when recording your streams, overwise ffMpeg is unable to decode them.
Hope this helps !
This isn't an exact answer, but some relevant notes I've made from investigating FLV files for a business requirement.
Most FLV audio is encoded in the MP3 format, meaning you can extract it directly from the FLV container. If the FLV was created from someone recording from their microphone, the audio is encoded with the Nellymoser Asao codec, which is proprietary (IIRC).
I'd check out libavcodec, which handles FLV/MP3/Nellymoser natively, and should let you get to the audio.
I'm currently using FFmpeg version SVN-r12665 for this, with no problems (the console version, without any wrapper library). There are some caveats to using console applications from non-console .NET environments, but it's all fairly straightforward. Using the libavcodec DLL directly is much more cumbersome.
I was going to recommend this: http://code.google.com/hosting/takenDown?project=nelly2pcm¬ice=7281.
But its been taken down. Glad I got a copy first :-)