View Full Version : How to re-encode audio track of an *.avi video from a script?
mike23
21st August 2011, 12:06
Lets assume I have an *.avi video file "aaaa.avi" with an (almost) unknown video codec and and (almost) unknown audio codec.
The video codec could be either
- Xvid or
- Divx or
- H.264/AVC
and the audio codec could be one of
- MP3 CBR
- MP3 VBR
- AC3
with an unknown bitrate/sample rate each.
Now I want to re-encode the audio part of input video file "aaaa.avi" and re-encode it to
(Lame)MP3 VBR, Stereo, Sample rate=44100, Minimum bitrate=128, Maximum bitrate=160 with maximum possible quality
How can I setup this encoding in an AVviSynth script?
Is there an instruction like:
AVISource("aaaa.avi").ConvertToMP3(....)
Thank you
Mike
Gavino
21st August 2011, 14:30
Avisynth is not involved in encoding as it always delivers uncompressed video and audio to its client application.
What you want to do is best done in VirtualDub (without Avisynth), where you can set the audio encoding parameters. If you don't want the video re-encoded, set the video mode to "Direct Stream Copy".
mike23
24th August 2011, 06:57
Avisynth is not involved in encoding as it always delivers uncompressed video and audio to its client application.
Hmm. I found in some AviSynth tutorials that it is possible to specify new resolution for the video for re-encoding similar to:
DirectShowSource("d:\believe.mpg").BicubicResize(320,240) + AVISource("D:\engel.avi")
So if it is possible to specify video-settings why not in a corresponding way for the audio part?
What you want to do is best done in VirtualDub (without Avisynth), where you can set the audio encoding parameters. If you don't want the video re-encoded, set the video mode to "Direct Stream Copy".
My problem described at the top of the thread is only a simplified, minor part of a big script to automize processing of whole directories and more. The original big, main task is NOT possible in an automatic way with VirtualDub (only with many manual steps which I want to avoid).
Maybe VirtualDub can use an AviSynth script.
So again: How can I specify audio codec settings in an AviSynth script?
Gavino
24th August 2011, 09:07
Hmm. I found in some AviSynth tutorials that it is possible to specify new resolution for the video for re-encoding similar to:
DirectShowSource("d:\believe.mpg").BicubicResize(320,240) + AVISource("D:\engel.avi")
So if it is possible to specify video-settings why not in a corresponding way for the audio part?
Changing the video resolution is not re-encoding, the new video is still delivered uncompressed to the Avisynth client, which is responsible for the encoding to an output file. Similarly, audio properties such as sample rate can be changed, but any compression via an audio codec must be done by the client.
Maybe VirtualDub can use an AviSynth script.
VirtualDub can use an Avisynth script as input, but it will see it as uncompressed video and audio.
So again: How can I specify audio codec settings in an AviSynth script?
As I said above, you can't.
mike23
26th August 2011, 07:41
So ok lets focus more on the original task:
Assume I have some (many) separate *.avi files with possibly different video and audio encoding settings.
I want to join/paste/append them into ONE target *.avi video file. This requires that some of the original *.avi must be re-encoded video and/or audio part. The new video and audio codec can be specified in VD.
But how can I tell to VirtualDub: "Get all video clips from AviSynth script myscript123.avs"?
Say the *.avi video files are named:
- series1num1.avi
- series1num2.avi
- mid3.avi
- series2num4.avi
How should this AviSynth script look like which delivers all
available *.avis above one after the other without stopping to VirtualDub?
Mike
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.