Log in

View Full Version : Convert Video files to AVI


PomeloWu
6th April 2006, 08:10
Hi all,

I met problems writing a small project that converts ASF files to AVI files using DirectShow. I chose "ffdshow video encoder" to encode the video to MPEG-4 format. Since the source ASF files' fps are not constant, around 10, while the AVI files are constantly set to 24, the playing time got changed after my program processed the conversion.

I guess some of the settings of the ffdshow filter (or, other filters?) should be changed. However, I do not know what properties should be adjusted, neither do I know how to change settings for the ffdshow filter.

Actually, I am writing a program intended to convert videos as possible to MPEG-4 encoded AVI files. My designing is, build up a filter graph that renders the video file, remove the render filters, and add encoder filters (ffdshow video encoder) as well as Mux filter, file write filter to the graph, reconnect the filter graph and run.

The program works well for conversion from uncompressed AVI, but meets problem as I referred above.
How can I resolve the problem? Or, do you have any suggestion to my program? Thanks in advance.

foxyshadis
6th April 2006, 11:18
If you're using directshow, you should be able to mux it to mkv instead of avi, then pull the timecodes out of the mkv with mkv2vfr. From there you can keep it in mkv, or use avisynth to convert each chunk of frames with a given framerate to a constant, ie, something like trim(1854,2183).assumefps(10.176).changefps(29.97) for each segment in the timecode file.

AVI simply won't be able to cope with the changing framerate without converting it to a constant rate.

PomeloWu
6th April 2006, 12:55
Thanks for replying. Your suggestion sounds good, but I have a few more questions.

1. How can I mux steams to a mkv? I did not found any filters registered in the OS.

2. I am not sure what to do after I get the vfr as in your suggestion. Using VirtualDub + Avisynth to make the AVI file?

3. A single program that takes charge of the whole progress of converting video to avi is wanted, rather than a batch of program operations. Akv2vfr and avisynth are easy to use, but I am not sure whether they could be easily integrated to my program.

foxyshadis
6th April 2006, 13:20
Oh! This is matroskamuxer:
http://sourceforge.net/project/showfiles.php?group_id=82303&package_id=85124

It is possible to work with avi and vfr through directshow, but you have to be tricky about it; bumping the avi up to 120+ fps and timing each frame from the source, inserting x drop frames to make up for the difference. As long as it's high enough resolution it shouldn't be jerky. I don't even know if that's really possible without a lot of groveling DS though, so if your workflow can support it, it'd be a lot easier to stick to mkv or mp4, which have no such vfr problems.

PomeloWu
7th April 2006, 03:42
Got it, I'll have a try.
So you suggested it is a problem that related to the muxer, but not the encoder, didn't you?