LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 12-25-2009, 10:30 PM   #1
DBabo
Member
 
Registered: Feb 2003
Distribution: Scientific Linux 6
Posts: 384

Rep: Reputation: 33
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.

Last edited by DBabo; 12-25-2009 at 10:35 PM.
 
Old 12-25-2009, 11:15 PM   #2
DBabo
Member
 
Registered: Feb 2003
Distribution: Scientific Linux 6
Posts: 384

Original Poster
Rep: Reputation: 33
I'm also not quite sure why, while input file has so many streams, ffmpeg only maps first 2 - one vide and one audio..
 
Old 12-26-2009, 07:01 AM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 1,506

Rep: Reputation: 233Reputation: 233Reputation: 233
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.......
 
Old 12-26-2009, 11:36 AM   #4
DBabo
Member
 
Registered: Feb 2003
Distribution: Scientific Linux 6
Posts: 384

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by Shadow_7 View Post
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?

Last edited by DBabo; 12-26-2009 at 01:27 PM. Reason: corrected the wording.
 
Old 12-26-2009, 01:31 PM   #5
DBabo
Member
 
Registered: Feb 2003
Distribution: Scientific Linux 6
Posts: 384

Original Poster
Rep: Reputation: 33
i tried -ac6 -ar 48000 - no luck. mplayer reports - no sound on the generated mpg file and getting the same errors as originally.
 
Old 12-29-2009, 08:14 PM   #6
DBabo
Member
 
Registered: Feb 2003
Distribution: Scientific Linux 6
Posts: 384

Original Poster
Rep: Reputation: 33
bump
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting animated gif to avi? (ffmpeg) zach014 Linux - Software 9 04-22-2010 08:09 AM
Converting flv to Mpg with Audio and ffmpeg btbx Linux - Software 7 06-12-2008 02:41 PM
converting vob to xvid using ffmpeg schneidz Linux - Software 3 12-07-2006 03:03 PM
h.264 Matroska video choppy under ffmpeg? mrchaos Linux - Software 0 12-28-2005 02:27 AM


All times are GMT -5. The time now is 05:29 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration