LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ffmpeg - no sound after converting matroska file (https://www.linuxquestions.org/questions/linux-software-2/ffmpeg-no-sound-after-converting-matroska-file-778115/)

DBabo 12-25-2009 10:30 PM

ffmpeg - no sound after converting matroska file
 
hello,
Happy holidays.

some time ago i put together a quick script to convert avi into mpg and, eventually, to DVD. The central part of it is:
Code:

ffmpeg $PARAM ${output_mpg}
where PARAM is a set of parameters (see below) and output_mpg is an output mpg file.
In 95% of situations this has been sufficient and i enjoyed the end result. But today i came across a "curious" mkv file.
First, the output of the command was :
Code:

PARAM = -ss 00:00:00 -t 5400 -i ./topSecret.mkv -target ntsc-dvd -aspect 16:9
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-x11grab
  libavutil    49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat  52.31. 0 / 52.31. 0
  libavdevice  52. 1. 0 / 52. 1. 0
  libswscale    0. 7. 1 /  0. 7. 1
  libpostproc  51. 2. 0 / 51. 2. 0
  built on Nov  6 2009 19:05:03, gcc: 4.1.2 20080704 (Red Hat 4.1.2-46)

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (24000/1001)
Input #0, matroska, from './topSecret.mkv':
  Duration: 01:30:06.12, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: h264, yuv420p, 716x480, PAR 40:33 DAR 179:99, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0.1(rus): Audio: aac, 48000 Hz, 5.1, s16
    Stream #0.2(eng): Audio: aac, 48000 Hz, 5.1, s16
    Stream #0.3(rus): Audio: aac, 48000 Hz, 5.1, s16
    Stream #0.4(eng): Audio: aac, 24000 Hz, stereo, s16
    Stream #0.5(bul): Subtitle: 0x0000
    Stream #0.6(dut): Subtitle: 0x0000
    Stream #0.7(eng): Subtitle: 0x0000
    Stream #0.8(eng): Subtitle: 0x0000
    Stream #0.9(nor): Subtitle: 0x0000
    Stream #0.10(por): Subtitle: 0x0000
    Stream #0.11(rus): Subtitle: 0x0000
    Stream #0.12: Attachment: mjpeg
    Stream #0.13: Attachment: mjpeg
    Stream #0.14: Attachment: mjpeg
    Stream #0.15: Attachment: mjpeg
    Stream #0.16: Attachment: mjpeg
Output #0, dvd, to 'out.mpg':
    Stream #0.0(eng): Video: mpeg2video, yuv420p, 720x480 [PAR 32:27 DAR 16:9], q=2-31, 6000 kb/s, 90k tbn, 29.97 tbc
    Stream #0.1(rus): Audio: ac3, 48000 Hz, stereo, s16, 448 kb/s
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
[aac @ 0x8acc3f0]channel element 1.2 is not allocated
Error while decoding stream #0.1
Error while decoding stream #0.1
Error while decoding stream #0.1
Error while decoding stream #0.1
Error while decoding stream #0.1

The "error" message floods the screen so i cancelled out of the program.

I made the following change:
Code:

ffmpeg $PARAM -acodec copy ${output_mpg}
which produced the output:
Code:

PARAM = -ss 5400 -t 5406.12 -i ./topSecret.mkv -target ntsc-dvd -aspect 16:9
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --mandir=/usr/share/man --incdir=/usr/include --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-x11grab
  libavutil    49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat  52.31. 0 / 52.31. 0
  libavdevice  52. 1. 0 / 52. 1. 0
  libswscale    0. 7. 1 /  0. 7. 1
  libpostproc  51. 2. 0 / 51. 2. 0
  built on Nov  6 2009 19:05:03, gcc: 4.1.2 20080704 (Red Hat 4.1.2-46)

Seems stream 0 codec frame rate differs from container frame rate: 47.95 (48000/1001) -> 23.98 (24000/1001)
Input #0, matroska, from './topSecret.mkv':
  Duration: 01:30:06.12, start: 0.000000, bitrate: N/A
    Stream #0.0(eng): Video: h264, yuv420p, 716x480, PAR 40:33 DAR 179:99, 23.98 tbr, 1k tbn, 47.95 tbc
    Stream #0.1(rus): Audio: aac, 48000 Hz, 5.1, s16
    Stream #0.2(eng): Audio: aac, 48000 Hz, 5.1, s16
    Stream #0.3(rus): Audio: aac, 48000 Hz, 5.1, s16
    Stream #0.4(eng): Audio: aac, 24000 Hz, stereo, s16
    Stream #0.5(bul): Subtitle: 0x0000
    Stream #0.6(dut): Subtitle: 0x0000
    Stream #0.7(eng): Subtitle: 0x0000
    Stream #0.8(eng): Subtitle: 0x0000
    Stream #0.9(nor): Subtitle: 0x0000
    Stream #0.10(por): Subtitle: 0x0000
    Stream #0.11(rus): Subtitle: 0x0000
    Stream #0.12: Attachment: mjpeg
    Stream #0.13: Attachment: mjpeg
    Stream #0.14: Attachment: mjpeg
    Stream #0.15: Attachment: mjpeg
    Stream #0.16: Attachment: mjpeg
Output #0, dvd, to 'out.mpg':
    Stream #0.0(eng): Video: mpeg2video, yuv420p, 720x480 [PAR 32:27 DAR 16:9], q=2-31, 6000 kb/s, 90k tbn, 29.97 tbc
    Stream #0.1(rus): Audio: libfaac, 48000 Hz, 5.1, s16
Stream mapping:
  Stream #0.0 -> #0.0
  Stream #0.1 -> #0.1
Press [q] to stop encoding
frame=  161 fps= 62 q=2.0 Lsize=    864kB time=5.34 bitrate=1325.8kbits/s

and the end result of the run was a DVD. Unfortunately dvd had no sound.

Please advise.
Thank you.

P.S. I do know that "ss" and "t" params don't work, but i doesn't bother me.

DBabo 12-25-2009 11:15 PM

I'm also not quite sure why, while input file has so many streams, ffmpeg only maps first 2 - one vide and one audio..

Shadow_7 12-26-2009 07:01 AM

It's not too uncommon for DVD files to have multiple streams. Audio in stereo or 5.1, different languages, different angles, and other things. You probably need to use the -map option to redirect 0.4 to 0.1. It seems to assume stereo for 0.1 which is 5.1. I generally handle audio in ffmpeg seperately, then rejoin at the end. Especially with AAC audio. It can do either audio or video well IMO. But not both at the same time in my experience. At least not with anything complex. Or if you're changing the format of both in one pass.

If you want the 0.1 stream (russian 5.1), then you might just need to be a bit more explicit -ac 6 -ar 48000.......

DBabo 12-26-2009 11:36 AM

Quote:

Originally Posted by Shadow_7 (Post 3805105)
It's not too uncommon for DVD files to have multiple streams. Audio in stereo or 5.1, different languages, different angles, and other things. You probably need to use the -map option to redirect 0.4 to 0.1. It seems to assume stereo for 0.1 which is 5.1. I generally handle audio in ffmpeg seperately, then rejoin at the end. Especially with AAC audio. It can do either audio or video well IMO. But not both at the same time in my experience. At least not with anything complex. Or if you're changing the format of both in one pass.

If you want the 0.1 stream (russian 5.1), then you might just need to be a bit more explicit -ac 6 -ar 48000.......

Thank you Shadow,
how can i "preserve" all of the streams in the source file while generating the target mpg file?

DBabo 12-26-2009 01:31 PM

i tried -ac6 -ar 48000 - no luck. mplayer reports - no sound on the generated mpg file and getting the same errors as originally.

DBabo 12-29-2009 08:14 PM

bump


All times are GMT -5. The time now is 07:14 AM.