LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Video DVD, ffmpeg ERRORS: ac3 and /dev/null; makemenu MPEG-2 (https://www.linuxquestions.org/questions/linux-newbie-8/video-dvd-ffmpeg-errors-ac3-and-dev-null%3B-makemenu-mpeg-2-a-775243/)

jiobo 12-12-2009 07:42 PM

Video DVD, ffmpeg ERRORS: ac3 and /dev/null; makemenu MPEG-2
 
In trying some DVD formats, I had some errors with ffmpeg preventing the creation of a Video DVD.

ffmpeg -codecs shows:
Code:

DEA ac3  ATSC A/52A  (AC-3)
This produces an error:
Code:

ffmpeg -i file.wav -ac 2 -ar 22050 -ab 282 -acodec ac3 -y file.ac3

No channel layout specified. The encoder will guess the layout, but it might be incorrect.
Error while opening encoder for output stream #0.0: maybe incorrect parameters such as bit rate, rate, width

This also produces an error:
(there is a typo in the title it should be /dev/zero)
Code:

ffmpeg -i /dev/zero -ac 2 -ar 22050 -ab 282 -acodec ac3 -y file.ac3

ERROR: /dev/zero unknown format

What libraries support ac3 encoding and decoding, and what ones are known to be fully functional with ffmpeg?

I also wanted to find out about using ffmpeg to recode the timestamps in separate MPEG-2 files so that they are sequential, but still separate files...without concatinating the files into one big file. For makemenu, it uses ac3 as the audio encoding for the DVD. Is ac3 considered the standard DVD audio format for NTSC Video DVDs so that it will play in any NTSC DVD player?

David the H. 12-13-2009 07:28 AM

Acceptable ac3 parameters for DVD, according to wikipedia, are:
Quote:

AC-3: 48 kHz sampling rate, 1 to 5.1 (6) channels, up to 448 kbit/s
Meaning that your sample rate is much too low. You need to use "-ar 44800" if you want it to be dvd-video compatible.

pcm and mp2 audio formats are also acceptable, within certain ranges. Check the link.

Code:

Error while opening encoder for output stream #0.0: maybe incorrect parameters such as bit rate, rate, width
It seems that ffmpeg only accepts certain combinations of bitrates and samplerates for ac3. Your command works if I change the -ab to 192k or 256k, for example. But I can only set it to 384k if I increase the samplerate to 44100 or 48000. I don't know if this is a limitation of ac3 itself, or just ffmpeg.

Also, starting a couple of years ago, ffmpeg changed the reading of the bitrate parameter to be bits-per-second. You need to use "-ab 256k" to specify kilobits.

Code:

ffmpeg -i /dev/zero -ac 2 -ar 22050 -ab 282 -acodec ac3 -y file.ac3

ERROR: /dev/zero unknown format

FFmpeg doesn't know what the endless stream of zeros it's getting is supposed to represent. If you want to create a silent ac3, you need to specify the input parameters of the raw data. I believe you can use something like this:

Code:

ffmpeg -ar 48000 -ac 2 -f s16le -i /dev/zero -acodec ac3 -ab 64k -t 4 silence.ac3
The parameters of ffmpeg before the input file specify what format the input will be read as, while the ones following it specify what the output value will be (parameters not explictly stated will be the same as the input). In this case, we're telling it to treat /dev/zero as if it were in the 16-bit pcm format (little-endian), but I suppose any of the raw pcm formats would work. Finally, use -t to state the number of seconds to encode.

jiobo 12-13-2009 10:32 PM

Quote:

Originally Posted by David the H. (Post 3789627)
Acceptable ac3 parameters for DVD, according to wikipedia, are:

Thanks for that. It should really be in the man pages under the heading for acodecs and "ac3"!!! Same for the other acodecs as well!

I did manage to get what I was trying to do done...but it would have been MUCH easier if the man pages were more detailed!!!

Quote:

pcm and mp2 audio formats are also acceptable
Most DVD players will also play mp2 audio, but it is not part of the "DVD" standard pushed by the industry.

Quote:

It seems that ffmpeg only accepts certain combinations of bitrates and samplerates for ac3.
It would be good if the man pages could be updated with acceptable bitrates and sampling rates for the codecs, both acodec and vcodec!!!

Quote:

FFmpeg doesn't know what the endless stream of zeros it's getting is supposed to represent. If you want to create a silent ac3, you need to specify the input parameters of the raw data.
Thanks for that. I had thought so. I got that code fragment from a web page on DVD creation. They could have been using an earlier version of ffmpeg, or more likely, they just didn't try it to see if it works! They could have defined default parameters in a configuration file for ffmpeg and not mentioned that in the web page.

I did manage to successfully build a Video DVD using Linux tools, mostly ffmpeg. It was a lot of work, and the documenation was not very good. It would be great if Linux users who know how to do Video DVD creation would help out with the man pages and documentation for it!

When I try out your code samples to see that they work, I can post again....since I worked around it in another way and got it to work.


All times are GMT -5. The time now is 09:24 AM.