I've read that I can use "ffmpeg -acodec copy" on a video file to extract the audio in its original unaltered format. But if I am trying to use ffmpeg in a batch file to extract audio from a bunch of different video files (MP4, FLV, MOV), then how do I know what extension (AAC, MP3, etc) to specify for the audio file? If I don't specify an extension, then ffmpeg gives me an error:
Code:ffmpeg -i test.mp4 -acodec copy extractedaudio FFmpeg version UNKNOWN, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --disable-shared --enable-memalign-hack --enable-gpl --cpu=i686 --enable-libmp3lame --enable-libfaac --enable-libamr-nb --enable-libamr-wb libavutil 50. 3. 0 / 50. 3. 0 libavcodec 52.23. 0 / 52.23. 0 libavformat 52.32. 0 / 52.32. 0 libavdevice 52. 2. 0 / 52. 2. 0 libswscale 0. 7. 1 / 0. 7. 1 built on Apr 4 2009 11:36:42, gcc: 4.2.1-sjlj (mingw32-2) Seems stream 1 codec frame rate differs from container frame rate: 59.94 (2997/5 0) -> 29.97 (30000/1001) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4': Duration: 00:03:05.61, start: 0.000000, bitrate: 2128 kb/s Stream #0.0(und): Audio: aac, 44100 Hz, stereo, s16 Stream #0.1(und): Video: h264, yuv420p, 1280x720 [PAR 1:1 DAR 16:9], 29.97 t br, 29.97 tbn, 59.94 tbc Unable to find a suitable output format for 'extractedaudio'
+ Reply to Thread
Results 1 to 3 of 3
-
Last edited by sldvd; 3rd Sep 2010 at 15:36.
-
Hi
I suppose you will need a more sophisticated script that would analyze each file then decide which extension to use.
In the meantime...
... it's quite legal to put mp3 audio in an mp4 container too.
So your command could be like this:-
Code:ffmpeg -i foo -vn -acodec copy output.mp4
(Use the -vn option to disregard the video track)
It's also possible to use the mka container, though some players might not recognize it.
Like this:-
Code:ffmpeg -i foo -vn -acodec copy output.mka
EDIT
There's a problem here.
If you have a video file named test.mp4 then you use my command to make an audio-only mp4 file you would need to give it a different name such as test_audio.mp4.
If you use the same filename for the output as the input file you might over-write it.
Alternatively, you could create a new folder to hold the audio files and direct the output files there.
Like this:-
Code:ffmpeg -i foo -vn -acodec copy ~/new_folder/output.mp4
Last edited by bat999; 7th Sep 2010 at 06:59.
-
Thanks for that information. I am just starting to realize the difference between containers and formats.
Similar Threads
-
FFmpeg on Win only - FAQ can ffmpeg realize screen capture
By feelart in forum Capturing and VCRReplies: 1Last Post: 14th Feb 2012, 04:11 -
Which ffmpeg options are used behind the scenes by ffmpeg?
By roberto.aloi in forum ffmpegX general discussionReplies: 1Last Post: 26th Jul 2011, 05:09 -
-acodec copy to 6 channel audio results in 2 channel?
By ninethirty in forum Video ConversionReplies: 1Last Post: 11th Feb 2011, 11:54 -
ffmpeg GUI that can "copy" into a different container?
By AlanHK in forum Video ConversionReplies: 4Last Post: 22nd Jul 2010, 02:37 -
FFMPEG QUESTION :How do I take one frame and make a jpeg with FFMPEG?
By goheadtry in forum Newbie / General discussionsReplies: 1Last Post: 18th Sep 2007, 02:55