Sunday, March 20, 2011

How to convert FLV or MP4 to Xvid with VirtualDub and join several video segments

This article is also useful to learn how to compress AVI video to Xvid, Divx or Dx50. You must take into account that VirtualDub just work with raw AVI video or its compressed formats.
A. FLV format
In order VirtualDub can open FLV, you must install "ffdshow tryouts" and "FLV Input driver":
1. Unzip FLV Input driver and put "FLVInputDriver.vdplugin" into your VirtualDub\plugins folder.

2. In the start menu click
"ffdshow-tryouts" and open "VFW configuration" (not "Video decoder configuration" which is for DirectShow decoding), go to the Decoder tab, Codecs section, and make sure FLV1 and VP6F are set to libavcodec (click on disabled and choose libavcodec).

3. Now VirtualDub is ready to open FLV!

* So that VirtualDub can read/uncompress the mp3 audio from FLV and other video formats:

Options --> Preferences --> AVI --> Check "Prefer Internal Audio decoders over..."

If you wish to convert FLV to Xvid or Divx (you must have the Xvid codec or ffdshow-tryouts installed):

1. *Follow this step just if you wanna join two or more video segments later.
Click Video --> Frame Rate and choose "Change frame rate to (fps)": put the same number as current followed by double 0: If it's 29.917 fps, change to 29.91700 fps (this is important, if you wanna join segment videos later, as they must have the same video and audio sampling rate).

2. If you wanna change the video size, or recut the image: add filters by clicking on Video --> Filters (first "perspective", then "resize"). The most common sizes are 320x240, 384x288, 480x360, 576x432, 592x336, 640x480.

3. Now to compress video: Video --> Full Processing Mode --> Compression: choose Xvid Codec and click "configure". On the right of Target Quantizer/Bitrate, click "calc": Put the exact duration of the video, and the wished Target Size (for example 8000 Kb for a 3 minutes video). The bigger the file size is, the higher the target bitrate is, and the higher the quality is.
* Clicking on "Other Options" you can choose the Encoder FourCC used: Xvid, Divx or Dx50.

4.And to compress audio: Audio--> Full Processing Mode --> Compression: choose Lame MP3 (you must have installed lameACM codec) --> 44100Hz, 128 kbps, CBR stereo (for example).

5. Now go to File --> Save video as AVI. It can takes more or less depending on the file size.

How to join several AVI video segments (VirtualDub can't join FLV video segments): First you must take into account, as VirtualDub documents say,: "What is the append function for, then? It's to re-splice a movie that has been split across multiple files to circumvent file size limits, mainly from video capture. Due to the granularity of audio and video streams, particularly when audio compression is in use, the files can't be cut exactly cleanly, and thus the video stream will be slightly longer than the audio stream, or vice versa. For this reason the Append function does an unaligned splice." That means the video segments must have the same Video and Audio Sampling Rate, same target bitrate, size, etc
1. Open the first video file, then select Video and Audio in "Direct Stream Copy".

2. Move video to the last frame.


3. File --> Append AVI segment --> select the second video segment.


4. File --> Append AVI segment --> select the third video segment.

5 File --> Save old format AVI (in that way, you keep the Xvid format).


In case you get an error "Cannot append segment: Video streams have different data formats", you must get they have the same Frame Rate:


1) Open VirtualDub
2) Open the first video.

3) Set "Video" and "Audio" to "Direct Stream Copy"

4) Video --> "Frame Rate" --> "Change framerate to (fps)": put the same number as current followed by double 0: If it's 29.917 fps, change to 29.91700 fps (frames per second)

5) Save old format AVI, with a new filename.

6) Keep VirtualDub open

7) Open the second file

8) Save old format AVI, with a new filename, and so on with the rest of segments.

9) Close VirtualDub

10) Open VirtualDub

11) Open the first file with updated Frame Rate.

12) Set "Video" and "Audio" to "Direct Stream Copy"

13) File --> Append AVI segment --> select the second video segment with updated Frame Rate.

14) Save old format AVI, with a new filename, and you have a Xvid video file with all the segments together!



B. MP4 format (H.264):
VDub can open MP4 video if you install the plugin: DShowInputDriver.vdplugin in Vdub plugins folder. However VDub can't open MP4 video if it has AAC audio (AAC- LC audio type). After many experiments, I got to that point. VDub can't open H.264 AVC1- AAC LC because of the AAC- LC audio (though ffdshow has the codecs for AAC and many more, it doesn't work for Vdub, at least I haven't got yet)
Many online tools let you download YouTube videos in MP4 format with high quality. If you wanna append MP4 (H.264 AVC1- AAC LC audio) video segments with Vdub, as you can't open them in Vdub, you could use a "mp4 to AVI converter" to convert the AAC audio to Lame MP3 (take into account the loss of video quality during conversion, though you keep the H.264 AVC1 format).
To check the real codec type and other parameters, before using MP4 to AVI converter, you can use Gspot.
C. Xvid format:

Many online tools let you download YouTube videos in AVI (Xvid/Divx) too. To open it with Vdub you must be sure there is no conflick with the codecs. First from Mmview disable Xvid decoder. Then, open ffdshow (VFW) and set Xvid to livabcodec.
My piece of advice when trying to open a video file in Vdub: check both the video and audio types it contains with Gspot and check if you have the plugins for Vdub or the codecs for that video/audio file.

5 comments:

Anonymous said...

you wrote


In order VirtualDub can open FLV, you must install "ffdshow tryouts" and "FLV Input driver":
1. Unzip FLV Input driver and put "FLVInputDriver.vdplugin" into your VirtualDub\plugins folder.

2. In the start menu click "ffdshow-tryouts" and open "VFW configuration" (not "Video decoder configuration" which is for DirectShow decoding), go to the Decoder tab, Codecs section, and make sure FLV1 and VP6F are set to libavcodec (click on disabled and choose libavcodec).

3. Now VirtualDub is ready to open FLV!

I Did What you wrote but it still did not work.

Anonymous said...

Is There An Other Way?

Anonymous said...

FFInputDriver works 100% with *.flv http://codecpack.co/download/FFInputDriver.html

The Blogger Around said...

In order to open a flv video in vdub you need the codecs for thatt video: the flvinputdriver is por video, but you have to be sure taht you also have the codec inside vdub for the audio of the video. Some flv resist to open because of the audio. Check the error window you get when you try to open it.
Hope it works!

The Blogger Around said...

To convert flv to xdiv or another format? Yes you can use a video converter like Super, this is a good one.

Post a Comment

Note: Only a member of this blog may post a comment.