Opened 15 months ago

Last modified 46 hours ago

#8349 reopened enhancement

Dolby AC-4 Support

Reported by: Nomis101 Owned by:
Priority: wish Component: undetermined
Version: git-master Keywords:
Cc: wrb2c@riede.org, talkenrain@gmail.com, ffmpeg@tmm1.net Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

It would be nice to support the detection, muxing and demuxing of Dolby AC-4 audio streams (in MP4 and MKV).

Information: https://dolbyac4.com/
Specs: https://www.dolby.com/us/en/technologies/ac-4/Next-Generation-Entertainment-Services.pdf
Sample files: http://testassets.dashif.org/#testcase/details/586fb3879ae9045678eab64f

MediaInfo? 19.09 added support for AC-4, so it would be nice to have support in FFmpeg as well.
https://mediaarea.net/MediaInfo/ChangeLog

Attachments (2)

frame-20-789726256.mpa (24.9 KB) - added by siryurian 5 weeks ago.
AC-4 sample from ATSC3.0
atsc3.ts (1.6 MB) - added by csdesigns 11 days ago.
ATSC 3.0 OTA 5.1

Download all attachments as: .zip

Change History (33)

comment:1 Changed 15 months ago by richardpl

  • Resolution set to wontfix
  • Status changed from new to closed

comment:2 Changed 15 months ago by richardpl

  • Component changed from avcodec to undetermined
  • Priority changed from normal to wish
  • Resolution wontfix deleted
  • Status changed from closed to reopened

comment:4 Changed 3 months ago by wriede

  • Cc wrb2c@riede.org added

ATSC3.0 Broadcast video uses AC-4 sound. Support for AC-4 in ffmpeg appears to be required for Plex TV to be used to play such video streams. I would like to see renewed urgency for this feature. Unfortunately I don't have enough knowledge on the subject to program something like this but I would be happy to help testing if that's of use.

comment:5 Changed 3 months ago by vogateer

I'd be willing to contribute a bit on money if it would help get AC-4 supported. Is there a preferred mechanism for funding such feature requests?

comment:6 Changed 8 weeks ago by talkenrain

  • Cc talkenrain@gmail.com added

There is a growing need for Dolby AC4 support within ffmpeg. As ATSC 3.0 broadcast becomes mainstream across the US many applications (like PLEX) depend on ffmpegs support of AC4 to be compatible with this growing format. Hardware that requires support has already hit the market. Please add me to the list of willing beta testers as the lack of AC4 support is now the only obstacle to full support with PLEX.

comment:7 Changed 6 weeks ago by billmackintosh

  • Priority changed from wish to important

It is very important to get AC-4 audio processing in ffmpeg for Plex users (such as myself) as ATSC 3.0 expands and hardware such as the HDHomeRun 4K tuner make use of this. Please add me to the list of potential beta testers as I have this setup (Plex & HDHomeRun 4K)

comment:8 Changed 6 weeks ago by cehoyos

  • Priority changed from important to wish

comment:9 Changed 6 weeks ago by netsjtr08

  • Priority changed from wish to important

Adding to the request for this development as well. no sound on plex with new ATSC 3.0 tuner.

comment:10 Changed 6 weeks ago by cehoyos

  • Priority changed from important to wish

comment:11 Changed 6 weeks ago by Chris_in_Texas

With more ATSC3.0 channels coming nationwide we really need support for AC3. This will become critical for other systems that use ffmpeg in short time. Please add AC3 support in so we can continue to view 4K ATSC TV.

comment:12 Changed 6 weeks ago by richardpl

Post short samples of various configurations.

comment:13 Changed 5 weeks ago by kyl416

If you want a starting point, check out this series of patches. Someone submitted them back in March to patchwork, but they failed some tests:
https://patchwork.ffmpeg.org/project/ffmpeg/list/?series=451

comment:14 follow-ups: Changed 5 weeks ago by richardpl

Looks like nobody cares about AC-4, because if they care they would actually provide AC-4 samples here.

Changed 5 weeks ago by siryurian

AC-4 sample from ATSC3.0

comment:15 in reply to: ↑ 14 Changed 5 weeks ago by kyl416

Replying to richardpl:

Looks like nobody cares about AC-4, because if they care they would actually provide AC-4 samples here.

siryurian just posted a sample for ATSC 3.0, but links to multiple AC-4 samples were already provided via the "DASH IF" link in the initial bug report. Just click "Accept" on their TOS popup and refresh the page to get a dozen different AC-4 samples for stereo, 5.1 and multitrack audio.

Also it's not that "nobody cares", it's that ATSC 3.0 is brand new and only active in select markets in the USA, the one device that allows the average user to view it on their PC only started shipping in October, and most users affected by this have no idea how to extract the AC-4 track to provide a usable sample. (Heck most of them had no idea that VLC, Kodi and Plex all rely on FFmpeg for audio and video decoding) I would have done it myself, but the 3 markets I have access to over the air, including the biggest market NYC, have not launched ATSC 3.0 services.

Last edited 5 weeks ago by kyl416 (previous) (diff)

comment:16 in reply to: ↑ 14 Changed 4 weeks ago by CBme

Replying to richardpl:
Looks like nobody cares about AC-4, because if they care they would actually provide AC-4 samples here.

That is false and absurd conclusion for a number of reasons. Here are 100 comments and rising of people starting to realize this show stopping problem. ​https://forum.silicondust.com/forum/viewtopic.php?f=133&t=74323
To any interested devs, please let us non devs know what is needed. How many clips? Does the video content matter (HD, standard def, progressive/interlaced). Do you want it where it transitions into commercials? etc.
Here is two longer HD clips from a progressive and borked interlaced stream (due to bug 4141) for anyone who can use them.
https://1drv.ms/u/s!Ap22nCAxKBS7j-Jr9Q8eX45gp2Uh7w?e=3miW5h

Last edited 4 weeks ago by CBme (previous) (diff)

comment:17 in reply to: ↑ 14 Changed 4 weeks ago by CBme

double post error

Last edited 4 weeks ago by CBme (previous) (diff)

comment:18 Changed 4 weeks ago by Nomis101

FYI, with the patches applied from comment 13, the AC-4 streams from the samples of comment 14 are properly detected as AC4. But the files do play with no sound, because the channels are not detected (says "0 channels"). MediaInfo? does detect the channels as "5.1 Main" and "Stereo Main".

% ffplay /Users/Nomis101/Downloads/ABC\ Stream\ -\ FFmpeg\ bug\ \#8349.ts
ffplay version N-100421-g1eb751955e Copyright (c) 2003-2020 the FFmpeg developers

built with Apple clang version 12.0.0 (clang-1200.0.32.28)
configuration: --pkg-config-flags=--static --enable-swscale --enable-avfilter --enable-fontconfig --enable-gpl --enable-version3 --enable-libass --enable-libbluray --enable-libfreetype --enable-libsoxr --enable-libaom --enable-libmp3lame --enable-librav1e --enable-encoder=librav1e --enable-libtheora --enable-libvorbis --enable-libvpx --disable-debug --enable-libmysofa --enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-libfdk-aac --enable-muxer=mov --enable-muxer=mp4 --enable-muxer=ipod --enable-encoder=eac3 --enable-encoder=ac3 --enable-encoder=flac --enable-ffplay --enable-librtmp --enable-libsmbclient --enable-opencl --enable-libssh --enable-openssl --enable-encoder=truehd --enable-bsf=aac_adtstoasc --enable-encoder=h264_videotoolbox --enable-encoder=hevc_videotoolbox --enable-sdl --extra-ldflags=-L/opt/local/lib
libavutil 56. 62.100 / 56. 62.100
libavcodec 58.115.102 / 58.115.102
libavformat 58. 65.100 / 58. 65.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7. 93.100 / 7. 93.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100

[NULL @ 0x7f81b782ce00] Decoder requires channel count but channels not set
[NULL @ 0x7f81b7817000] Decoder requires channel count but channels not set
[NULL @ 0x7f81b782da00] Decoder requires channel count but channels not set
[mpegts @ 0x7f81b7808a00] stream 3 : no PTS found at end of file, duration not set
[mpegts @ 0x7f81b7808a00] Could not find codec parameters for stream 1 (Audio: ac4 (AC-4 / 0x342D4341), 0 channels): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7f81b7808a00] Could not find codec parameters for stream 2 (Audio: ac4 (AC-4 / 0x342D4341), 0 channels): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
[mpegts @ 0x7f81b7808a00] Could not find codec parameters for stream 3 (Audio: ac4 (STPP / 0x50505453), 0 channels): unspecified sample rate
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, mpegts, from '/Users/polysom/Downloads/ABC Stream - FFmpeg bug #8349.ts':

Duration: 00:01:15.34, start: 12951.873511, bitrate: 3690 kb/s
Program 3

Stream #0:0[0x31]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024), yuv420p10le(tv), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x32](eng): Audio: ac4 (AC-4 / 0x342D4341), 0 channels
Stream #0:2[0x33](spa): Audio: ac4 (AC-4 / 0x342D4341), 0 channels
Stream #0:3[0x3a](ee`): Audio: ac4 (STPP / 0x50505453), 0 channels

[hevc @ 0x7f81b886d200] Could not find ref with POC 56
[hevc @ 0x7f81b8814e00] Could not find ref with POC 32 0B f=0/0
[hevc @ 0x7f81b8814e00] Could not find ref with POC 24
[hevc @ 0x7f81b8814e00] Could not find ref with POC 16
13006.05 M-V: -0.025 fd= 305 aq= 0KB vq= 370KB sq= 0B f=0/0

Last edited 4 weeks ago by Nomis101 (previous) (diff)

comment:19 Changed 4 weeks ago by Nomis101

Ah, sorry, the "0 channel" thing was just because of AV_CODEC_CAP_CHANNEL_CONF. If I add that to ac4dec.c I have sound with the sample files from above. So, it seems with this patch we are on a good way...

ffplay /Users/Nomis101/Downloads/ABC\ Stream\ -\ FFmpeg\ bug\ \#8349.ts
ffplay version N-100421-g1eb751955e Copyright (c) 2003-2020 the FFmpeg developers

built with Apple clang version 12.0.0 (clang-1200.0.32.28)
configuration: --pkg-config-flags=--static --enable-swscale --enable-avfilter --enable-fontconfig --enable-gpl --enable-version3 --enable-libass --enable-libbluray --enable-libfreetype --enable-libsoxr --enable-libaom --enable-libmp3lame --enable-librav1e --enable-encoder=librav1e --enable-libtheora --enable-libvorbis --enable-libvpx --disable-debug --enable-libmysofa --enable-libx264 --enable-libx265 --enable-libxvid --enable-nonfree --enable-libfdk-aac --enable-muxer=mov --enable-muxer=mp4 --enable-muxer=ipod --enable-encoder=eac3 --enable-encoder=ac3 --enable-encoder=flac --enable-ffplay --enable-librtmp --enable-libsmbclient --enable-opencl --enable-libssh --enable-openssl --enable-encoder=truehd --enable-bsf=aac_adtstoasc --enable-encoder=h264_videotoolbox --enable-encoder=hevc_videotoolbox --enable-sdl --extra-ldflags=-L/opt/local/lib
libavutil 56. 62.100 / 56. 62.100
libavcodec 58.115.102 / 58.115.102
libavformat 58. 65.100 / 58. 65.100
libavdevice 58. 11.103 / 58. 11.103
libavfilter 7. 93.100 / 7. 93.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100

[mpegts @ 0x7fd2f082ac00] stream 3 : no PTS found at end of file, duration not set
Input #0, mpegts, from '/Users/Nomis101/Downloads/ABC Stream - FFmpeg bug #8349.ts':

Duration: 00:01:15.34, start: 12951.873511, bitrate: 3690 kb/s
Program 3

Stream #0:0[0x31]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024), yuv420p10le(tv), 1280x720 [SAR 1:1 DAR 16:9], 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc
Stream #0:1[0x32](eng): Audio: ac4 (AC-4 / 0x342D4341), 48000 Hz, 5.1(side), fltp
Stream #0:2[0x33](spa): Audio: ac4 (AC-4 / 0x342D4341), 48000 Hz, stereo, fltp
Stream #0:3[0x3a](ee`): Audio: ac4 (STPP / 0x50505453), 48000 Hz, 3.0, fltp

[hevc @ 0x7fd308885c00] Could not find ref with POC 56
13030.02 A-V: 0.019 fd= 174 aq= 0KB vq= 0KB sq= 0B f=0/0

comment:20 Changed 3 weeks ago by tmm1

  • Cc ffmpeg@tmm1.net added

I have a patch that fixed some issues with a few stations: https://github.com/FFmpeg/FFmpeg/commit/1b9ae54caf9d1b038583ee9d1e94f130b42b5f7d

comment:21 Changed 3 weeks ago by richardpl

Do you have samples to reproduce this, as that patch contradicts with specifications.

comment:22 follow-ups: Changed 3 weeks ago by richardpl

comment:23 follow-up: Changed 3 weeks ago by georgeP

All i know is all the main stations in seattle have switched to ATSC 3.0 so I upgraded to a new HDHomeRun 4k for my Plex DVR. All I can see is really clear video with no audio stream found. So no football for me or anyone else in the same situation. Happy to help however I can and willing to chip in if needed.

comment:24 in reply to: ↑ 23 ; follow-ups: Changed 3 weeks ago by cehoyos

Replying to georgeP:

Happy to help however I can

Did you see comment:14 and comment:21?

comment:26 in reply to: ↑ 24 Changed 3 weeks ago by georgeP

Replying to cehoyos:

Replying to georgeP:

Happy to help however I can

Did you see comment:14 and comment:21?

I have no idea how to do that. If you can provide instructions I will try.

comment:27 Changed 3 weeks ago by vogateer

I've uploaded a TS file from an OKC OTA station with AC-4 audio here:
https://drive.google.com/file/d/1xpEyd59cD4NgLtfYsWuBOrMjovzCO7xj/view?usp=sharing

Unfortunately I can't figure out how to demux the TS file and just upload the audio portion. If anyone has instructions for that, please let me know. I could record multiple samples.

comment:28 Changed 2 weeks ago by phroenips

Two more samples. These are 30 second extracts from a HDHomerun Quatro 4K. I'm also not sure how to demux just the audio, so these are video and audio

https://1drv.ms/v/s!ArfvDX-zLpfP9XamL2kwsu2JnpKR?e=TBE0XE
https://1drv.ms/v/s!ArfvDX-zLpfP9XVdkW4CMgI5EIKd?e=XvsCgN

comment:29 in reply to: ↑ 22 Changed 2 weeks ago by mooninite

Replying to richardpl:

This is latest AC4 WIP code: https://github.com/richardpl/FFmpeg/tree/ac4

I tested these patches against a 4.3 branch (Fedora/RPMFusion) and could successfully play live streaming data in the Dallas, TX market from a SiliconDust? CONNECT 4K and Kodi. Audio is working. Thanks!

comment:30 in reply to: ↑ 22 Changed 2 weeks ago by Nomis101

Replying to richardpl:

This is latest AC4 WIP code: https://github.com/richardpl/FFmpeg/tree/ac4

Playback does also work nicely for me. But if I try to convert the audio stream in e.g. AAC, I see different errors with the provided samples.

Sample from comment 24 gives me:
[ac4 @ 0x7fef1480a200] substream audio data overread: 1153
Error while decoding stream #0:0: Invalid data found when processing input
[ac4 @ 0x7fef1480a200] substream audio data overread: 598
Error while decoding stream #0:0: Invalid data found when processing input
[ac4 @ 0x7fef1480a200] substream audio data underread: 8
[ac4 @ 0x7fef1480a200] substream audio data underread: 10eed= 229x
[ac4 @ 0x7fef1480a200] sect_cb[0][0] > 11
Error while decoding stream #0:0: Invalid data found when processing input
[ac4 @ 0x7fef1480a200] substream audio data underread: 257
[ac4 @ 0x7fef1480a200] substream audio data underread: 131
[ac4 @ 0x7fef1480a200] substream audio data overread: 1217
Error while decoding stream #0:0: Invalid data found when processing input
[ac4 @ 0x7fef1480a200] substream audio data underread: 104
[ac4 @ 0x7fef1480a200] substream audio data underread: 119
[ac4 @ 0x7fef1480a200] sect_cb[0][0] > 11
Error while decoding stream #0:0: Invalid data found when processing input
[ac4 @ 0x7fef1480a200] sect_cb[0][3] > 11
Error while decoding stream #0:0: Invalid data found when processing input
[ac4 @ 0x7fef1480a200] substream audio data underread: 106
[ac4 @ 0x7fef1480a200] substream audio data underread: 122
[ac4 @ 0x7fef1480a200] sect_cb[0][0] > 11
Error while decoding stream #0:0: Invalid data found when processing input

Sample from comment 27 gives me:
[ac4 @ 0x7fe01f008c00] substream audio data overread: 2
Error while decoding stream #0:1: Invalid data found when processing input
[mpegts @ 0x7fe020809a00] Packet corrupt (stream = 0, dts = 1229347550).
[ac4 @ 0x7fe01f008c00] invalid aspx num env: 7 (class 3)
Error while decoding stream #0:1: Invalid data found when processing input

Sample (first one) from comment 28 gives me:
[ac4 @ 0x7ff98980f600] substream audio data overread: 6
Error while decoding stream #0:2: Invalid data found when processing input

Changed 11 days ago by csdesigns

ATSC 3.0 OTA 5.1

comment:31 in reply to: ↑ 22 Changed 46 hours ago by ferrellsl

Replying to richardpl:

This is latest AC4 WIP code: https://github.com/richardpl/FFmpeg/tree/ac4

I completed a successful MSYS2 x64 build and everything is working great for ATSC3.0/AC4 streams in the greater Phoenix area. For those who want to run the binaries outside of the MSYS2 shell, you will need to copy the following DLL files to the folder where your ffmpeg binaries ultimately reside.

They are:

libbz2-1.dll
libiconv-2.dll
libintl-8.dll
liblzma-5.dll
libstdc++-6.dll
libwinpthread-1.dll
libzstd.dll
SDL2.dll
zlib1.dll

On my system these DLL's are located at: C:\msys64\mingw64\bin

For those who don't want to build from source, you can download the Windows binaries from my DropBox? account here: https://www.dropbox.com/s/c3tnl4a3fk3ldwm/ffmpeg-ac4.zip?dl=0

Note: See TracTickets for help on using tickets.