I have a video stream (XVID) and an audio stream (mp3) in an AVI file.
I also have a video stream (x264) and an audio stream (aac) in an MKV file.
I want to extract the VIDEO stream from the AVI (xvid) and the AUDIO stream from the MKV (aac), and create an AVI.
So, to extract the video from the avi, I tried:
ffmpeg -i OLD.AVI -f rawvideo -vcodec rawvideo NEW.AVI
As far as I understand this should give me an AVI file, without AUDIO, but instead gives me a big AVI that can not be played.
I also tried ffmpeg -i OLD.avi -acodec copy NEW.avi but the video gets re-encoded somehow, and it is even shorter than the original.
So, how do I extract the original XVID from an avi?
Then, lets suppose the video thing gets solved, I would need to extract the AAC and convert to CBR MP3 (mkvtoolnix/foobar) an mix it with the new avi using:
ffmpeg -i AUDIO.mp3 -i NEW.avi FULL.avi
I'm correct?
Any other comments? Thanks!
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 10 of 10
Thread
-
Last edited by kwanbis; 13th Apr 2012 at 19:16.
-
ffmpeg does include a 'copy' command, which might work better for you. For example:
Code:ffmpeg -i video.mp4 -vcodec copy -acodec copy video.avi
(-vcodec and -acodec are actually aliases for the -c:/-codec: command, but it should still work the same, I believe:
Code:‘-c[:stream_specifier] codec (input/output,per-stream)’ ‘-codec[:stream_specifier] codec (input/output,per-stream) ’Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. codec is the name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded. For example ffmpeg -i INPUT -map 0 -c:v libx264 -c:a copy OUTPUT encodes all video streams with libx264 and copies all audio streams. For each stream, the last matching c option is applied, so ffmpeg -i INPUT -map 0 -c copy -c:v:1 libx264 -c:a:137 libvorbis OUTPUT will copy all the streams except the second video, which will be encoded with libx264, and the 138th audio, which will be encoded with libvorbis.
Note: I'm by no means an expert on ffmpeg, and don't use it manually except on rare occasions, so hopefully, someone more experienced than I will be able to help. )Last edited by Ai Haibara; 13th Apr 2012 at 22:39.
If cameras add ten pounds, why would people want to eat them? -
Well, I actually want to copy VIDEO from the AVI, and AUDIO from the MKV, to a new avi, but the MKV is AAC, so i need to extract the audio first, convert to mp3, and then merge. Anyway, that is the easy part, as the mkv tools are great, but so far, the avi tools are much more complicated, so I was thinking maybe I should do
Code:ffmpeg -i old.AVI -vcodec copy new.AVI
-
Part of the problem is AAC audio is not completely compatible in AVI. (You can do it, but lots of compatibility problems with many applications and hardware players)
Also , are you adverse to doing this with other programs, or does it have to be ffmpeg?
I think this should work, it assumes that audio is track #1 in the mkv file and video is track #0. You can find out by using ffmpeg -i input.mkv and it will list the tracks. Otherwise you have to change the -map value
Code:ffmpeg -i input.avi -vcodec copy -i input.mkv -map 0:1 -acodec copy output.avi
Last edited by poisondeathray; 14th Apr 2012 at 12:28.
-
Yeah, I could easily do this with other programs, including VirtualDubMod. Maybe AVI-Mux GUI, but I've never really used it, so I don't know for sure.
If cameras add ten pounds, why would people want to eat them? -
I know the aac is not compatible and so i have already extracted it and converted it to MP3. So, to simplify, lets assume I have some avis, about 60, and that I want to add them the MP3 audio.
The other thing is that I want to remove the original audio.
It does not has to be ffmpeg, but i like command line tools, cause you can do it in batches. -
-
Sorry, put the inputs first, and specify stream maps for them both (again this assumes that the mkv has audio as track #1, and video as track #0)
Code:ffmpeg -i input.avi -i input.mkv -map 0:0 -map 1:1 -vcodec copy -acodec libmp3lame output.avi
-
It is working with
Code:ffmpeg -i old.avi -i old.mkv -map 0:0 -map 1:1 -vcodec copy -acodec libmp3lame -ab 128k output.avi
Thanks.
Similar Threads
-
MKV guide, Play MKV, MKV to AVI, MKV to DVD, MKV to MP4, MKV to Blu-ray
By Baldrick in forum Newbie / General discussionsReplies: 55Last Post: 29th Jun 2012, 11:19 -
ffmpeg: getting quality loss of avi when adding audio back in
By vidgem in forum AudioReplies: 2Last Post: 15th Mar 2012, 23:39 -
How to make Dual audio on mkv video without converting to AVI
By Aboudi09 in forum Video ConversionReplies: 9Last Post: 21st Jul 2009, 13:17 -
rewrap mov to avi with ffmpeg but audio not seekable
By yannanlu in forum Video ConversionReplies: 0Last Post: 8th May 2009, 16:17 -
ffmpeg choppy audio from large avi but not small avi source file
By cybertheque in forum CapturingReplies: 9Last Post: 13th Oct 2008, 15:38