I'm using this command line to extract the audio
$ffmpeg -i video.mkv -c:a pcm_s16le audio.wav
this is its output
ffmpeg version 1.0 Copyright (c) 2000-2012 the FFmpeg developers
built on Oct 1 2012 10:47:52 with gcc 4.0.1 (GCC) (Apple Inc. build 5493)
configuration: --prefix=/Volumes/Ramdisk/sw --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --enable-libgsm --arch=x86 --enable-runtime-cpudetect
libavutil 51. 73.101 / 51. 73.101
libavcodec 54. 59.100 / 54. 59.100
libavformat 54. 29.104 / 54. 29.104
libavdevice 54. 2.101 / 54. 2.101
libavfilter 3. 17.100 / 3. 17.100
libswscale 2. 1.101 / 2. 1.101
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.111.0
Duration: 01:29:59.83, start: 0.000000, bitrate: 832 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 720x406, 762 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 64 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Output #0, wav, to 'audio.wav':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf54.29.104
Stream #0:0(eng): Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Stream mapping:
Stream #0:1 -> #0:0 (aac -> pcm_s16le)
Press [q] to stop, [?] for help
size= 1012464kB time=01:29:59.82 bitrate=1536.0kbits/s
video:0kB audio:1012464kB subtitle:0 global headers:0kB muxing overhead 0.000004%
Then the audio is normalized and put back into the video file
ffmpeg -i video.mkv -i audio_normalized.wav -map 0:0 -map 1:0 -c:v copy -c:a libmp3lame -b:a 64k video_normalized.mkv
Sometimes the video won't play in my ipod touch, or plays muted
When that happens, I convert the video to AVI, with the same quality, wich gives a bigger file more often than not
ffmpeg -sameq -i video.mp4 video.avi
I just wondered whether there is a way to always change the container file to AVI with the same video quality and replace the sound with the normalized audio in one step
-sameq. – LordNeckbeard Dec 16 '12 at 17:49-sameq. It does not mean "same quality" and this option has recently been removed from ffmpeg. – LordNeckbeard Dec 16 '12 at 19:02ffmpeg -i video.mkv -i audio_normalized.wav -map 0:0 -map 1:0 -c:v copy -c:a aac -strict experimental -b:a 192k video_normalized.mp4I increased the audio bitrate because the native ffmpeg AAC encoder,aac, isn't great at lower bitrates. – LordNeckbeard Dec 18 '12 at 2:55