I am trying to compress an AVI file using Visual Basic 6.0 but having trouble finding out information on how I can do this.
I am aware that I may be able to use direct show and use the File Source, AVI Compressor and File Writer filters but in quick tests I have not been able to get the Pins of the Filters to Connect.
Is there any other simple mmethod of achieving this such as a DLL?
Thanks/
If you have an AVI file, you can go
AVI File -> AVI SPlitter -> (compressor/encoder like ffdshow video encoder) -> AVI Mux -> File writer
turned a 2.16gb avi into a 5.56mb avi
Are you sure you mean compress? Your question lack information but I think you want to convert the file using ffmpeg/libav to another format.
Related
I use MFCreateSourceReaderFromByteStream to create an IMFSourceReader with a custom IMFByteStream getting data from a remote HTTP source.
When the source is an m4a file, everything works as expected. However, When the source is mp3, the function MFCreateSourceReaderFromByteStream does not return until the whole file is downloaded. Any idea on how to avoid that behavior and start to decode audio before the end of the download?
Assuming you are using default mediafoundation source, perhaps this is the default behaviour for the MP3 File Source and MPEG-4 File Source.
To confirm this, you can try using a custom audio mpeg file source, like this one I implemented : MFSrMpeg12Decoder
This mediafoundation source only manages mp1/mp2 audio file, and performs the decoding.This is not mp3, but it provides the bytestream once there is a valid audio mpeg header, and does not read full file (you can trust me...).
This will confirm that default MP3 File Source needs to read full file before provided the bytestream.
One possible answer would be that the MP3 file source reads the entire file to see if there is a variable bit rate, and thus provides the correct duration of the file (MF_PD_DURATION).
For m4a audio file, the duration is provided by the moov atom, so no need to read full file.
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.
I'm looking to write already compressed (h264) image data into an MPEG-4 video file. Since this code needs to be optimized to run on an embedded platform the code should be as simple as possible.
Best would be to just give some header information (like height width format fourcc etc.) and a filename and the compressed data and have that transformed into a data chunck and writen to that file.
So what i need either of these:
MPEG-4 header information (what goes where exactly)
Is there a main header or are there just headers for each data chunck
What header information is needed for a single video stream (rectangular)
What header information is needed for adding audio
A simple MPEG-4 file writer that does not have to do the compression itself and also allows to add audio frames. (c/c++)
.MP4 file format is described in MPEG-4 Part 14 specification. It is not just main header and subheaders, it has certain hierarchy and so called boxes in there. Some of your choice to write data into .MP4 file:
FFmpeg (libavcodec, libavformat) - related Q and related code link
In Windows via DirectShow API - GDCL MP4 Multiplexer or numerous commerical similar offerings
In Windows via Media Foundation API - MPEG-4 File Sink
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)
My application is transforming an AVI video file into another AVI file. I use
the OpenCV library. Unfortunately videos created with OpenCV have no sound as the library does not support audio.
Is there any easy way to copy the audio track from one video file to another? Maybe FFmpeg?
My application is written in Visual C++.
You can use FFmpeg. The easiest way would be to just use the command line tool to extract/reassemble. If you need your application to do it itself, looking into the sources for how they do it should help.
Alternatively, as you mention VC++, why not use DirectShow? It should not be too difficult to sink the audio into a file for extraction and later sink the video/audio mix into a file for composition.