AC3 encoding problem - wrong audio tag?

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

AC3 encoding problem - wrong audio tag?

Stefan Gofferje
Hi,

I have recently changed my home video editing to Linux (kdenlive) to get
finally completely rid of Windows. Now I'm trying to encode some
home-video with ac3 sound. I do the testing/playing with a Pinnacle
Showcenter network media player which is connected via fiber-optic cable
to a Haman Kardon amplifier.

When I play my the encoded file, the amp show "Dolby 2/0" and is silent.
The Showcenter shows as audio type "Ogg". File shows

RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
audio: (6 channels, 48000 Hz)

If I check older files that work on the Showcenter, the output of file is:

RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
audio: Dolby AC3 (stereo, 48000 Hz)

So in my encoding, the "Dolby AC3" tag seems to be missing.

I use

ffmpeg version 0.11.1 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jun 15 2012 15:33:11 with gcc 4.5.1 20101208 [gcc-4_5-branch
revision 167585]
  configuration: --prefix=/usr --mandir=/usr/share/man
--libdir=/usr/lib64 --shlibdir=/usr/lib64 --disable-stripping
--enable-pthreads --enable-shared --enable-avfilter --disable-static
--enable-libfaac --enable-libmp3lame --enable-libxvid --enable-libx264
--enable-nonfree --enable-postproc --enable-shared --enable-libdc1394
--enable-libtheora --enable-libschroedinger --enable-libvpx --enable-gpl
--enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3
--enable-x11grab
  libavutil      51. 54.100 / 51. 54.100
  libavcodec     54. 23.100 / 54. 23.100
  libavformat    54.  6.100 / 54.  6.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     2. 77.100 /  2. 77.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100

and my command-line is like

ffmpeg -i video.mp4 -i left.wav -i right.wav -i surr_left.wav -i
surr_right.wav -i center-wav -i lfe-wav -vcodec libxvid -s 624x352 -b:v
1100k -acodec ac3 -ar 48000 -ab 448k video.avi

Any hints?

-Stefan

--
 (o_   Stefan Gofferje            | SCLT, MCP, CCSA
 //\   Reg'd Linux User #247167   | VCP #2263
 V_/_  Heckler & Koch - the original point and click interface


--------------------------------------------------------------------------------
This mail was scanned for malware by ClamAV (http://www.clamav.net/)
--------------------------------------------------------------------------------

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Carl Eugen Hoyos
Stefan Gofferje <ffmpeg-user <at> home.gofferje.net> writes:

> RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
> audio: (6 channels, 48000 Hz)
          ^

> If I check older files that work on the Showcenter, the output of file is:
>
> RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
> audio: Dolby AC3 (stereo, 48000 Hz)
                    ^^^^^^

FFmpeg developers believe that the Microsoft specification
requires an avi muxer to use different headers (WAVEFORMATEX)
depending on the number of channels (stereo vs 6 channels).
Many playback applications are unable to read the header that is -
as we believe - required for surround sound.

(Note that stereo files should work fine.)

There are many reports about this, so far nobody could provide
any indication that FFmpeg developers are wrong in their
interpretation of the standard.
(The best test would be with a Xbox - if it turns out that the
Xbox does not read the waveformatextensible header, the code
will probably be changed, see ticket #253.)

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Stefan Gofferje
Hi,

On 07/13/2012 11:33 AM, Carl Eugen Hoyos wrote:
>> RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
>> audio: Dolby AC3 (stereo, 48000 Hz)
>                     ^^^^^^

Oops... here is a file output from another one:
RIFF (little-endian) data, AVI, 720 x 480, 23.98 fps, video: XviD,
audio: Dolby AC3 (6 channels, 48000 Hz)

> FFmpeg developers believe that the Microsoft specification
> requires an avi muxer to use different headers (WAVEFORMATEX)
> depending on the number of channels (stereo vs 6 channels).
> Many playback applications are unable to read the header that is -
> as we believe - required for surround sound.

I don't really understand what you are talking about. I'm not very deep
in this codec stuff, just a video hobbyist.
Are you saying, it is not possible to create ac3 streams with ffmpeg
that have the Dolby AC3 tag and work on network media players with Dolby
certified amplifiers?

-Stefan

--
 (o_   Stefan Gofferje            | SCLT, MCP, CCSA
 //\   Reg'd Linux User #247167   | VCP #2263
 V_/_  Heckler & Koch - the original point and click interface


--------------------------------------------------------------------------------
This mail was scanned for malware by ClamAV (http://www.clamav.net/)
--------------------------------------------------------------------------------

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Stefan Gofferje
I tried with menconder. Mencoder does produce files which are correctly
recognized as Dolby 5.1 by file as well as by the Network Media Player
and my amplifier.

-Stefan

--
 (o_   Stefan Gofferje            | SCLT, MCP, CCSA
 //\   Reg'd Linux User #247167   | VCP #2263
 V_/_  Heckler & Koch - the original point and click interface


--------------------------------------------------------------------------------
This mail was scanned for malware by ClamAV (http://www.clamav.net/)
--------------------------------------------------------------------------------

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Carl Eugen Hoyos
Stefan Gofferje <ffmpeg-user <at> home.gofferje.net> writes:

> I tried with menconder. Mencoder does produce files which are correctly
> recognized as Dolby 5.1 by file as well as by the Network Media Player
> and my amplifier.

Don't forget that MEncoder is not an actively maintained application
for several years.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Stefan Gofferje
Carl,

On 07/14/2012 12:33 PM, Carl Eugen Hoyos wrote:
> Don't forget that MEncoder is not an actively maintained application
> for several years.

What can I do...? :)
The ffmpeg-developers seem to utilize an interpretation of a standard
which seems to be not much widely shared, hence the created files don't
work - as you said yourself - with many software. And - what's important
for me - with my hardware. As the Showcenter uses a very widespread
hardware and software platform, it's quite likely that the files don't
work properly on a broad variety of other hardware players as well.

No offense, but frankly, I don't really care about the interpretation of
the standard. When it comes to ffmpeg, I'm just a dumb user. I want to
watch my homevideos on my hardware media player and on my LG Smart TV.
And I want my files to work on the players of my friends and family.
If that doesn't work, I will not buy a new hardware player or a new
Smart TV which complies with the ffmpeg interpretation of a standard,
nor will I tell all my friends and family that they have to go and buy
new players. Using a software that creates working files is much easier
for me and if - due to lack of maintenance - mencoder will not be
available in time, I will have to find another solution. But I worry
about that then.

Again, no offense :).

Besides, the easiest way for ffmpeg to keep "the standard" but still be
useable for the people with the disagreeing players would be, as a
compromise, to include an additional video encoding option switch, e.g.
"-ddcompat" (Dolby Digital compatibility), which activates "nonstandard"
behavior and explain this in the documentation.

-Stefan

--
 (o_   Stefan Gofferje            | SCLT, MCP, CCSA
 //\   Reg'd Linux User #247167   | VCP #2263
 V_/_  Heckler & Koch - the original point and click interface


--------------------------------------------------------------------------------
This mail was scanned for malware by ClamAV (http://www.clamav.net/)
--------------------------------------------------------------------------------

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Carl Eugen Hoyos
Stefan Gofferje <ffmpeg-user <at> home.gofferje.net> writes:

> What can I do...? :)

Did you test if my interpretation of your problem is correct at all?
(Iirc you did not post complete, uncut FFmpeg console output
or did you?)
Note that it is extremely simple to force FFmpeg to produce
invalid files, just look at line 452 of libavformat/riff.c
(make it channels > 20 or something similar)

> The ffmpeg-developers seem to utilize an interpretation of a standard
> which seems to be not much widely shared

I googled for waveformatextensible yesterday and any other
(less strict) interpretation of the standard seems truly absurd to me.
After testing that this is indeed the problem, could you add more
information about your setup? It seems extremely unlikely to me that
a Dolby decoder cares at all about a riff / wav header...

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Stefan Gofferje
On 07/14/2012 02:05 PM, Carl Eugen Hoyos wrote:
> Did you test if my interpretation of your problem is correct at all?

No, because - as I wrote - I'm not really deep in the codec topic. The
only "test" I know is file and in vlc tools -> Codec information.

> (Iirc you did not post complete, uncut FFmpeg console output
> or did you?)

No, because the console output didn't produce anything that looked
suspicious to me, such as warnings or errors. I will retrace my steps
and log the process.

> Note that it is extremely simple to force FFmpeg to produce
> invalid files, just look at line 452 of libavformat/riff.c
> (make it channels > 20 or something similar)

I have only very limited programming skills in bash, C and Java. I'm
mainly a network/security guy. I don't compile ffmpeg myself. I use the
Packman repo for Opensuse.

> I googled for waveformatextensible yesterday and any other
> (less strict) interpretation of the standard seems truly absurd to me.
> After testing that this is indeed the problem, could you add more
> information about your setup? It seems extremely unlikely to me that
> a Dolby decoder cares at all about a riff / wav header...

My setup in this case is:

- Linux Server with Swisscenter (media server software for Syabas based
network media players) and Mediatomb (DLNA server software)
- Client 1: LG SmartTV (DLNA client)
- Client 2: Pinnacle Showcenter 200 connected to an Haman Kardon AVR35
Dolby Digital / DTS receiver via optical cable

Both clients don't play any sound with the ffmpeg-generated file. If I
press "file info" on the Showcenter, it claims, Video: XVID, Audio: OGG.
The AVR35 displays "Dolby 2/0" and produces no sound.

In the file info in the Swisscenter menu, the file shows as 5.1 but
without the Dolby Digital logo.

As I wrote before, the Linux command "file" outputs

RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
audio: (6 channels, 48000 Hz)

Note the missing codec info for the audio stream!

The file I created with mencoder plays on both clients in 5.1 mode. The
"file" command shows

RIFF (little-endian) data, AVI, 624 x 352, 23.98 fps, video: XviD,
audio: Dolby AC3 (6 channels, 48000 Hz)

Note the codec info "Dolby AC3" for the audio stream!

Also, in Swisscenter, the file has the Dolby Digital logo in addition to
the 5.1 logo.

So, without knowing anything about codecs and headers specifically, I
would wildly guess, that there is something like a "Dolby Digital" flag
or tag which is not set by ffmpeg.

If it helps, I could create 2 short videos, 1 with ffmpeg, 1 with
mencoder and put them for download to my website. That would allow a
direct comparison. That might take a moment though. I already deleted
the source files from this project.

If it is important - I use the ffmpeg lavc for encoding ac3 in mencoder.

-Stefan

--
 (o_   Stefan Gofferje            | SCLT, MCP, CCSA
 //\   Reg'd Linux User #247167   | VCP #2263
 V_/_  Heckler & Koch - the original point and click interface


--------------------------------------------------------------------------------
This mail was scanned for malware by ClamAV (http://www.clamav.net/)
--------------------------------------------------------------------------------

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Andy Furniss
In reply to this post by Carl Eugen Hoyos
Carl Eugen Hoyos wrote:

> Stefan Gofferje <ffmpeg-user <at> home.gofferje.net> writes:
>
>> What can I do...? :)
>
> Did you test if my interpretation of your problem is correct at all?
> (Iirc you did not post complete, uncut FFmpeg console output
> or did you?)
> Note that it is extremely simple to force FFmpeg to produce
> invalid files, just look at line 452 of libavformat/riff.c
> (make it channels > 20 or something similar)
>
>> The ffmpeg-developers seem to utilize an interpretation of a standard
>> which seems to be not much widely shared
>
> I googled for waveformatextensible yesterday and any other
> (less strict) interpretation of the standard seems truly absurd to me.
> After testing that this is indeed the problem, could you add more
> information about your setup? It seems extremely unlikely to me that
> a Dolby decoder cares at all about a riff / wav header...

May be taking the thread OT, but I don't know.

I do have access to an xbox if you want someone to test something.

One thing I notice is that if I make ac3 with ffmpeg then mediainfo
shows the channels like -

Channel positions                        : Front: L C R, Back: L R, LFE
Channel positions                        : 3/0/2.1

I know mediainfo is not rated here :-) but the one thing I find it handy
for is ac3. mediainfo -f will instantly show me if some "kind" person
has ripped out drc/other metainfo. I don't know a quick way to see that
with ffmpeg.

Testing dvds ac3 mediainfo shows -

Channel positions                        : Front: L C R, Side: L R, LFE
Channel positions                        : 3/2/0.1

ffmpeg -i says side for both cases - made with ffmpeg -

  Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 48000 Hz, 5.1(side),
s16, 448 kb/s

and for a dvd

Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), s16, 448 kb/s
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Andy Furniss
Andy Furniss wrote:

> One thing I notice is that if I make ac3 with ffmpeg then mediainfo
> shows the channels like -
>
> Channel positions                        : Front: L C R, Back: L R, LFE
> Channel positions                        : 3/0/2.1

This only seems to happen with avi.

I've done the same test with mpeg, mkv and m2ts and it looks normal with
them.

It also reports dialnorm of -31 for these but nothing for avi.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

Carl Eugen Hoyos
In reply to this post by Andy Furniss
Andy Furniss <andyqos <at> ukfsn.org> writes:

> One thing I notice is that if I make ac3 with ffmpeg then mediainfo
> shows the channels like -
>
> Channel positions                        : Front: L C R, Back: L R, LFE
> Channel positions                        : 3/0/2.1

> Channel positions                        : Front: L C R, Side: L R, LFE
> Channel positions                        : 3/2/0.1

This is completely unrelated to the original question.
(Why is a waveformatextensible header written for Dolby
Surround?)

Allow me to repeat what I wrote in the ticket:
I am absolutely willing to help with this problem, but
changing FFmpeg so it does something that the specification
does not allow at least needs excessive testing - I would
expect that WMP does not play the invalid samples.

Carl Eugen

_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

rogerdpack2
In reply to this post by Stefan Gofferje
>> (Iirc you did not post complete, uncut FFmpeg console output
>> or did you?)
>
> No, because the console output didn't produce anything that looked
> suspicious to me, such as warnings or errors. I will retrace my steps
> and log the process.

It does tell us which version of ffmpeg you're using, which is at
least something helpful.
-roger-
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|

Re: AC3 encoding problem - wrong audio tag?

nieznosnik
In reply to this post by Stefan Gofferje
After a huge searching throught the Internet I finally found the solution for ffmpeg to produce file with proper (for me) AC3.

I have sometimes films (with unsupported AC3 from default ffmpeg and/or problems with video) which I can't play on my LG TV, so I use this command to decode and it plays well.

 ffmpeg -fflags +genpts -i input.mkv/avi -threads 4 -vcodec libx264 -b 3000k -pix_fmt yuv420p -acodec ac3 -ac 6 -ar 48000 -ab 448k -dialnorm -24 -dsur_mode 0 -original 1 -dmix_mode 2 -f matroska output.mkv

Maybe it helps somebody which searching for it.