Log in

View Full Version : [SOLVED]ffmpeg, strange working with 2 audio tracks


cord-factor
4th January 2010, 18:51
Hello,
I have one mkv file with xvid video stream and two ac3 audio streams.
I want to remux it to avi container. What should I do?

I tried this:

$ ffmpeg -i Beast\,\ The\ part-1.mkv out2.avi -vcodec copy -acodec copy -map 0:0 -map 0:1 -map 0:2 -acodec copy -newaudio
FFmpeg version SVN-r20373, Copyright (c) 2000-2009 Fabrice Bellard, et al.
built on Jan 1 2010 12:14:31 with gcc 4.4.2
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-static --enable-shared --cc=x86_64-pc-linux-gnu-gcc --disable-debug --disable-ffplay --disable-network --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libx264 --enable-libxvid --disable-indev=v4l --disable-indev=jack --enable-x11grab --enable-libfaad --enable-libopenjpeg --enable-libfaac --enable-nonfree --disable-vdpau --disable-vdpau --disable-altivec --disable-mmx --disable-mmx2 --enable-pic --cpu=host --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-avfilter-lavf --disable-stripping --enable-hardcoded-tables
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.37. 1 / 52.37. 1
libavformat 52.39. 2 / 52.39. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1. 4. 1 / 1. 4. 1
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, matroska, from 'Beast, The part-1.mkv':
Duration: 01:26:44.54, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mpeg4, yuv420p, 720x544 [PAR 1:1 DAR 45:34], 23.98 tbr, 1k tbn, 23.98 tbc
Stream #0.1(eng): Audio: ac3, 48000 Hz, 2 channels, s16
Stream #0.2(rus): Audio: ac3, 48000 Hz, 2 channels, s16
[mpeg4 @ 0x4ad3f000ef0]removing common factors from framerate
Output #0, avi, to 'out2.avi':
Stream #0.0: Video: mpeg4, yuv420p, 720x544 [PAR 1:1 DAR 45:34], q=2-31, 200 kb/s, 23.98 tbn, 23.98 tbc
Stream #0.1(eng): Audio: mp2, 48000 Hz, 2 channels, s16, 64 kb/s
Stream #0.2(rus): Audio: ac3, 48000 Hz, 2 channels, s16
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Stream #0.2 -> #0.2
Press [q] to stop encoding
[NULL @ 0x4ad3effc550]error, non monotone timestamps 12288 >= 12288
av_interleaved_write_frame(): Error while opening file

and, what's the matter with first audio track (0.1)?
(everywhere I use 'copy' option)
Input has ac3 audio, but output wanted to do mp2 :mad:

Help me, please!

jruggle
4th January 2010, 19:22
i would suggesting asking on the ffmpeg-user mailing list
http://ffmpeg.org/contact.html

Dark Shikari
4th January 2010, 19:37
ffmpeg cannot use -vcodec copy on MKV streams with B-frames due to a bug.

roozhou
5th January 2010, 02:50
ffmpeg cannot use -vcodec copy on MKV streams with B-frames due to a bug.

I submitted a patch to fix this. Look at this thread (http://roundup.ffmpeg.org/roundup/ffmpeg/issue807).

Unfortunately I only provide win32 builds, so you have to make your own build with this patch.

J_Darnley
5th January 2010, 15:26
and, what's the matter with first audio track (0.1)?
(everywhere I use 'copy' option)
Input has ac3 audio, but output wanted to do mp2 :mad:

Help me, please!
You didn't tell ffmpeg to copy because you are not using ffmpeg correctly. Usage:
ffmpeg [input options] -i input [output options] output [new stream stuff]

You have no output options, so ffmpeg uses it's defaults. You mean:
ffmpeg -i file.mkv -vcodec copy -acodec copy -map 0:0 -map 0:1 -map 0:2 file.avi -acodec copy -newaudio

(But this will still encounter the "non-monotone timestamps" error)

cord-factor
5th January 2010, 16:41
Yes, ffmpeg doesn't love matroska :( (avi with no such error)
What else can I use in my case?

b66pak
5th January 2010, 20:12
@ cord-factor use mkvtoolnix suite for linux for demuxing video to .avi and audios to .ac3...then use ffmpeg to mux all to .avi...

http://www.bunkus.org/videotools/mkvtoolnix/downloads.html
_

cord-factor
5th January 2010, 21:01
Thanks, mkvextract+ffmpeg did it.

derrensmiths
21st January 2010, 07:28
Hi,
Thanks for sharing such nice information.

cord-factor
17th July 2010, 11:31
Hi,
Thanks for sharing such nice information.
any time...
but "non-monotone timestamps" bug is still there :(