AC-4 Audio?

ATSC 3.0 Forum
Post Reply
mooninite
Posts: 22
Joined: Wed Dec 19, 2018 9:13 pm
x 4

Re: AC-4 Audio?

Post by mooninite »

Lost Dog wrote: Fri Jan 15, 2021 5:16 pm
mooninite wrote: Wed Dec 30, 2020 9:43 pm
That branch is against the main trunk. I compiled a 4.3.x version and Kodi now plays audio for ATSC 3.0 Dallas, TX stations (H.265 + AC-4).

I expect it will take a few months for slower distributions to get ffmpeg 4.4 / 5.0 that will carry this support, but we'll be there much sooner than I guessed.
I compiled the AC-4 branch of ffmpeg and using ffplay I got audio from a ATSC 3.0 stream!!! Woo hoo! This is a start!

How did you get Kodi playing the AC-4? Did you have to compile Kodi against the ffmpeg branch?
Fedora compiles Kodi with external ffmpeg support so updating ffmpeg is all I need to do. The distro you are using most likely uses the internal Kodi copy of ffmpeg and yes you will need to recompile Kodi.

Christian
Posts: 4
Joined: Wed Jan 20, 2021 1:29 pm

Re: AC-4 Audio?

Post by Christian »

ferrellsl wrote: Thu Jan 14, 2021 5:44 pm I completed a successful MSYS2 x64 build of ffmpeg that supports AC-4 audio streams 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 in: C:\msys64\mingw64\bin

For those who want to conduct their own build, you can get the source for the AC-4/WIP here: https://github.com/richardpl/FFmpeg/tree/ac4

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/eene7ecard5xk ... 4.zip?dl=1

An example command to play channel 161.1 here in Phoenix follows: C:\ffmpeg\bin>ffplay -i "http://192.168.2.142:5004/auto/v161.1?transcode=native" -ac 4
Substitute the IP address above with the correct IP address for your HD Homerun Tuner.


Enjoy!
Is it eventually possible that you could compile the shared libraries (avcodec-57.dll etc.) for win32 too? I try to create a basic player using ffmpeg libs with ac4, but I horribly failed under windows and on linux the build script for windows I am using is also not working.

Cheers
Christian

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

Christian wrote: Wed Jan 20, 2021 1:32 pm

Is it eventually possible that you could compile the shared libraries (avcodec-57.dll etc.) for win32 too? I try to create a basic player using ffmpeg libs with ac4, but I horribly failed under windows and on linux the build script for windows I am using is also not working.

Cheers
Christian
I'm actually attempting to build VLC today using richardpl's AC-4 branch of ffmpeg. After some hackery on the rules.mak file in the vlc/contrib/src/ffmpeg folder I was able to start compiling. I'll post the results when the build succeeds or fails.

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

ferrellsl wrote: Wed Jan 20, 2021 2:42 pm
Christian wrote: Wed Jan 20, 2021 1:32 pm

Is it eventually possible that you could compile the shared libraries (avcodec-57.dll etc.) for win32 too? I try to create a basic player using ffmpeg libs with ac4, but I horribly failed under windows and on linux the build script for windows I am using is also not working.

Cheers
Christian
I'm actually attempting to build VLC today using richardpl's AC-4 branch of ffmpeg. After some hackery on the rules.mak file in the vlc/contrib/src/ffmpeg folder I was able to start compiling. I'll post the results when the build succeeds or fails.

VLC is a dumpster fire in terms of building. Problems range from regression errors to broken scripts. I spent a day and a half trying to build it against the AC-4 branch and whenever I fixed one problem it would expose 3 more so I'm giving up for now.

Lost Dog
Posts: 140
Joined: Tue Jul 03, 2007 11:46 pm
x 6

Re: AC-4 Audio?

Post by Lost Dog »

ferrellsl wrote: Thu Jan 21, 2021 12:03 pm VLC is a dumpster fire in terms of building. Problems range from regression errors to broken scripts. I spent a day and a half trying to build it against the AC-4 branch and whenever I fixed one problem it would expose 3 more so I'm giving up for now.
:lol:

I've been trying as well but I can't figure out how to get it to build off the ffmpeg-ac4 branch. At one point I thought I had tricked it by using the "contrib method" but got no ac-4 audio once it compiled.

Make sure you are using the latest release version of the source and not the main trunk. When I was using main it was nothing but compile errors. The vlc-3.0.12 source worked great (but without the ac-4 integration).

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

Lost Dog wrote: Thu Jan 21, 2021 4:20 pm
ferrellsl wrote: Thu Jan 21, 2021 12:03 pm VLC is a dumpster fire in terms of building. Problems range from regression errors to broken scripts. I spent a day and a half trying to build it against the AC-4 branch and whenever I fixed one problem it would expose 3 more so I'm giving up for now.
:lol:

I've been trying as well but I can't figure out how to get it to build off the ffmpeg-ac4 branch. At one point I thought I had tricked it by using the "contrib method" but got no ac-4 audio once it compiled.

Make sure you are using the latest release version of the source and not the main trunk. When I was using main it was nothing but compile errors. The vlc-3.0.12 source worked great (but without the ac-4 integration).

Like you, I also tried the latest VLC code from the repo and got much further along than I did with the release code on github that's over 4 years old now. I made it all the way to the point where the VLC binary was being built but it errored out on some QT related files some 8 hours later.

To insert the AC-3 branch of ffmpeg into the build I made the following edits to the rules.mak file located in vlc/contrib/src/ffmpeg/

#Uncomment the one you want
#USE_LIBAV ?= 1
USE_FFMPEG ?= 1

ifndef USE_LIBAV
FFMPEG_HASH=0
FFMPEG_GITURL := https://github.com/richardpl/FFmpeg.git

I turned on an ffmpeg build by removing the comment character (USE_FFMPEG ?= 1), updated the giturl to the AC-4 branch, set the hash to 0 and then on line 288 I disabled the hash check by simply commenting that line with a #.

# $(call check_githash,$(FFMPEG_HASH))

Next, I made a folder called ffmeg-0 inside the vlc/contrib/tarballs and put richardpl's branch into that folder. Next, I simply compressed that folder to a tar.xz file (ffmpeg-0.tar.xz). This will get you past the "make fetch" and hashcheck issues with richardpl's code.

The ffmpeg-0 folder name is important because the script will now look for a tar file called ffmpeg-0.tar.xz.

Next, you have to make dummy patches out of the ones included in the latest VLC sources. Go to the vlc/contrib/srcs/ffmpeg folder and edit the patch files located there. I simply edited each patch and removed the code inside each patch, then saved the changes and left the modified files inside the folder.

I hit a couple more roadblocks that were easily fixed. The build complained about meson, python and nasm missing but I quickly added those and moved forward. I made it all the way to the assembly and link phase for the VLC exe binary when I hit a problem with some of the QT object files, and at that point decided to give it a rest.

Anyway, I hope this helps. I'd really like to have a copy of VLC that supports AC-4 audio.

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

Well, I made significant progress and was able to successfully build VLC against the AC-4 branch (64-bit Windows). I don't get any AC-4 audio playback though and the binary crashes on my Windows 10 machine but it runs just fine under Windows 7 and 8.

Here's my initial bootstrap:

../bootstrap --disable-chromaprint --host=i686-w64-mingw32 --disable-fluid --disable-fluidlite --disable-protobuf --disable-soxr

I had to disable chromaprint, protobuf, soxr and fluid due to errors and the make script also failed because it couldn't find libavcodec.a or nettle.a even though they were being built in the /vlc/contrib/i686-w64-ming32/lib folder. To get around this I just copied them to /usr/i686-w64-ming32/lib as I didn't feel like chasing down multiple scripts for a fix.

I'll keep fiddling with this and see if I can get AC-4 audio working but don't hold your breath.

75038EarlyAdopter
Posts: 1
Joined: Sat Nov 21, 2020 8:28 pm

Re: AC-4 Audio?

Post by 75038EarlyAdopter »

Worked great, played 149.1 here in Dallas.
ferrellsl wrote: Thu Jan 14, 2021 5:44 pm I completed a successful MSYS2 x64 build of ffmpeg that supports AC-4 audio streams 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....

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

ferrellsl wrote: Sat Jan 23, 2021 1:14 am Well, I made significant progress and was able to successfully build VLC against the AC-4 branch (64-bit Windows). I don't get any AC-4 audio playback though and the binary crashes on my Windows 10 machine but it runs just fine under Windows 7 and 8.

Here's my initial bootstrap:

../bootstrap --disable-chromaprint --host=i686-w64-mingw32 --disable-fluid --disable-fluidlite --disable-protobuf --disable-soxr

I had to disable chromaprint, protobuf, soxr and fluid due to errors and the make script also failed because it couldn't find libavcodec.a or nettle.a even though they were being built in the /vlc/contrib/i686-w64-ming32/lib folder. To get around this I just copied them to /usr/i686-w64-ming32/lib as I didn't feel like chasing down multiple scripts for a fix.

I'll keep fiddling with this and see if I can get AC-4 audio working but don't hold your breath.
Well, I'm gonna give the VLC build a rest. I've spent the better part of a week building and testing for Win64 with limited success. Adding the ffmpeg AC-4 branch to the build did not enable AC-4 audio playback as I had hoped so there have to be more adjustments that need to be made that are outside the scope of my abilities and patience. Hopefully Lost Dog will be successful with his efforts. Version 4.0.0-dev of VLC looks and works really slick and from a UI standpoint it is a huge improvement over version 3.0. There has been a lot of work to make VLC 4 friendlier for touchscreen devices and that's probably where the focus should stay until the maintainers get all the UI bugs squashed. I really don't expect to see AC-4 support baked into VLC until richardpl gets his AC-4 branch of ffmpeg mainlined into the ffmpeg trunk, then that updated ffmpeg trunk will have to be incorporated into the VLC trunk. That could take quite a while. I will say that this attempt at building VLC has helped me understand just how difficult it is for the VLC maintainers to get things right, at least from a Windows-build standpoint, and my hat is off to them. This is the biggest build project that I've ever dealt with outside of OpenSceneGraph and the experience overall hasn't been a pleasant one. So for now I'm just gonna be happy that at least we have a Win64 version of ffmpeg that also handles AC-4 and head off to bed.

Lost Dog
Posts: 140
Joined: Tue Jul 03, 2007 11:46 pm
x 6

Re: AC-4 Audio?

Post by Lost Dog »

ferrellsl wrote: Sat Jan 23, 2021 9:03 pm
Well, I'm gonna give the VLC build a rest. I've spent the better part of a week building and testing for Win64 with limited success. Adding the ffmpeg AC-4 branch to the build did not enable AC-4 audio playback as I had hoped so there have to be more adjustments that need to be made that are outside the scope of my abilities and patience. Hopefully Lost Dog will be successful with his efforts.
I've not had any luck on linux either. I've tried multiple attempts and ways to compile against the ffmpeg-ac4 branch but have had no luck. I get a clean compile but ac-4 audio never plays. Kodi was simple to get working!

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

Lost Dog wrote: Mon Jan 25, 2021 8:42 am
ferrellsl wrote: Sat Jan 23, 2021 9:03 pm
Well, I'm gonna give the VLC build a rest. I've spent the better part of a week building and testing for Win64 with limited success. Adding the ffmpeg AC-4 branch to the build did not enable AC-4 audio playback as I had hoped so there have to be more adjustments that need to be made that are outside the scope of my abilities and patience. Hopefully Lost Dog will be successful with his efforts.
I've not had any luck on linux either. I've tried multiple attempts and ways to compile against the ffmpeg-ac4 branch but have had no luck. I get a clean compile but ac-4 audio never plays. Kodi was simple to get working!
Yeah, it was disappointing to put in that amount of time and effort and not have AC-4 audio. I even made sure that the VLC source code was compiling against the AC-4 branch by checking the tarballs, the ffmpeg/AC-4 sources, the lib.a files, etc, at build time and was sort of surprised when I got video without AC-4 audio. VLC just has so many moving parts in terms of dependencies. I'm glad that I don't regularly work on projects with that many dependencies in constant flux because I think I'd lose my mind.

kyl416
Posts: 173
Joined: Wed Sep 17, 2014 12:09 pm
Device ID: 1080DB11
Location: Tobyhanna, PA
x 29
Contact:

Re: AC-4 Audio?

Post by kyl416 »

VLC doesn't use ffmpeg's libavformat for demuxing streams, they use internal demuxers alongside libdvbpsi, so you have to add AC-4 as a recognized codec in key files like include/vlc_fourcc.h, src/misc/fourcc_list.h and modules/codec/avcodec/fourcc.c along with various files inside the modules/demux/mpeg, modules/demux/mp4 and modules/demux/mkv folders.

If you want a starting point, search for the string "EAC3" in the VLC source folder to see an example of how the code should be formatted in each file, then look at the patches made to add AC4 support to FFmpeg to get the correct fourcc values.

If you want to go the extra step and add support for AC4 passthru, you also need to add the values to the include/vlc_aout.h and modules/codec/spdif.c files along with various files inside modules/stream_out/chromecast and modules/audio_output folders.

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

ferrellsl wrote: Mon Jan 25, 2021 1:55 pm
Lost Dog wrote: Mon Jan 25, 2021 8:42 am
ferrellsl wrote: Sat Jan 23, 2021 9:03 pm
Well, I'm gonna give the VLC build a rest. I've spent the better part of a week building and testing for Win64 with limited success. Adding the ffmpeg AC-4 branch to the build did not enable AC-4 audio playback as I had hoped so there have to be more adjustments that need to be made that are outside the scope of my abilities and patience. Hopefully Lost Dog will be successful with his efforts.
I've not had any luck on linux either. I've tried multiple attempts and ways to compile against the ffmpeg-ac4 branch but have had no luck. I get a clean compile but ac-4 audio never plays. Kodi was simple to get working!
Yeah, it was disappointing to put in that amount of time and effort and not have AC-4 audio. I even made sure that the VLC source code was compiling against the AC-4 branch by checking the tarballs, the ffmpeg/AC-4 sources, the lib.a files, etc, at build time and was sort of surprised when I got video without AC-4 audio. VLC just has so many moving parts in terms of dependencies. I'm glad that I don't regularly work on projects with that many dependencies in constant flux because I think I'd lose my mind.
That's good to know, so it makes me wonder why ffmpeg is even one of the default build dependencies. I'm an applications programmer in the field of LIDAR so I'm way out of my element in terms of audio/video codecs and muxing/demuxing. Maybe if you have some free time you could take a stab at building an AC-4 capable version of VLC. Plenty of folks here would certainly appreciate it. Heck, I'd even settle for a much less robust player that doesn't have hundreds of dependencies as long as I could get video with AC-4 audio. Looked around for some media player repos on github but they all seem to be targeting IOS or Android.

kyl416
Posts: 173
Joined: Wed Sep 17, 2014 12:09 pm
Device ID: 1080DB11
Location: Tobyhanna, PA
x 29
Contact:

Re: AC-4 Audio?

Post by kyl416 »

ferrellsl wrote: Mon Jan 25, 2021 3:29 pmso it makes me wonder why ffmpeg is even one of the default build dependencies.
While they don't use ffmpeg's libavformat to handle some formats like mpeg, mp4, mkv, they still need it to handle many other media formats. They also need ffmpeg's libavcodec to decode and encode most audio and video, along with some other key ffmpeg libraries like libpostproc and libswscale.

ferrellsl
Posts: 36
Joined: Sat Oct 17, 2020 11:57 pm
Location: Mesa, AZ
x 13
Contact:

Re: AC-4 Audio?

Post by ferrellsl »

ferrellsl wrote: Wed Jan 20, 2021 2:42 pm
Christian wrote: Wed Jan 20, 2021 1:32 pm

Is it eventually possible that you could compile the shared libraries (avcodec-57.dll etc.) for win32 too? I try to create a basic player using ffmpeg libs with ac4, but I horribly failed under windows and on linux the build script for windows I am using is also not working.

Cheers
Christian
I'm actually attempting to build VLC today using richardpl's AC-4 branch of ffmpeg. After some hackery on the rules.mak file in the vlc/contrib/src/ffmpeg folder I was able to start compiling. I'll post the results when the build succeeds or fails.
Here's a Win64 build with the shared libraries. https://www.dropbox.com/s/bze1a5nrhq63u ... d.zip?dl=1

Here's a list of files in the archive:
avcodec-58.dll
avcodec.dll
avdevice-58.dll
avdevice.dll
avfilter-7.dll
avfilter.dll
avformat-58.dll
avformat.dll
avutil-56.dll
avutil.dll
ffmpeg.exe
ffplay.exe
ffprobe.exe
libbz2-1.dll
libiconv-2.dll
libintl-8.dll
liblzma-5.dll
libstdc++-6.dll
libwinpthread-1.dll
libzstd.dll
SDL2.dll
swresample-3.dll
swresample.dll
swscale-5.dll
swscale.dll
zlib1.dll

Post Reply