Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avcodec: add ac-4 decoder #387

Merged
merged 8 commits into from
Jul 16, 2024
Merged

avcodec: add ac-4 decoder #387

merged 8 commits into from
Jul 16, 2024

Conversation

gnattu
Copy link
Member

@gnattu gnattu commented May 2, 2024

Changes

Added the AC-4 decoder for ATSC 3.0 audio. Experimental. Decoder only. Remuxing is limited to mpegts containers and in my opinion should not be used and always convert into a more compatible format for jellyfin use cases.

Should not be enabled until at least Jellyfin 10.10 in my opinion.

Tested with sample files provided on dolby's website: https://ott.dolby.com/OnDelKits/AC-4/Dolby_AC-4_Online_Delivery_Kit_1.5/help_files/topics/kit_wrapper_MP4_multiplexed_streams.html

Support currently limited to common channel configurations. Dolby Atmos features like 5.1.4 channel configuration (5.1 channel with additional overhead channels) and AC4-IMS is not supported.

Issues

Fixes #311
Closes #128

@gnattu gnattu requested a review from a team May 2, 2024 16:15
@nyanmisaka nyanmisaka marked this pull request as draft May 3, 2024 01:36
@nyanmisaka
Copy link
Member

Can this be easily ported to FFmpeg 7.0+? Will this cause existing fate tests to fail?

@gnattu
Copy link
Member Author

gnattu commented May 3, 2024

Can this be easily ported to FFmpeg 7.0+? Will this cause existing fate tests to fail?

The demuxer and encoder is already in the 7.0, so the only thing need to be ported is the decoder itself. Is there even fate tests for AC4 yet?

@nyanmisaka
Copy link
Member

Can this be easily ported to FFmpeg 7.0+? Will this cause existing fate tests to fail?

The demuxer and encoder is already in the 7.0, so the only thing need to be ported is the decoder itself. Is there even fate tests for AC4 yet?

I think you mean de/muxer (libavformat). Then this should be easy enough to maintain for decoding purposes, hopefully there won't be more breaking changes.

Raw AC-4 muxer and demuxer

I would have thought there might be some tests in richardpl's fork. But due to some personal reasons, he deleted the repo.

https://github.com/richardpl/FFmpeg/tree/ac4

@gnattu
Copy link
Member Author

gnattu commented May 3, 2024

I think you mean de/muxer (libavformat). Then this should be easy enough to maintain for decoding purposes, hopefully there won't be more breaking changes.

Yes, the libavformat one. I did not port the muxer because I just want to enable transcode to prevent all kinds of compatibility issues.

Also, I just finished the 7.0 port and I do have a ready-to-go working tree based on the release/7.0 branch.

I would have thought there might be some tests in richardpl's fork. But due to some personal reasons, he deleted the repo.

I checked on upstream ffmpeg, there is none in the 7.0 branch yet.

gnattu added 8 commits July 16, 2024 16:56
Experimental. Decoder only. Remuxing is limited to mpegts containers.
- avcodec/ac4dec_data: declare qwin aligned as required by vector_fmul
- avcodec/ac4dec: avoid division by zero
- avcodec/ac4dec: fix channel mapping for 5.1 decode w/ 2ch_mode
- avformat/ac4dec: fix order of operations
- avcodec/utils: add ac4 frame duration
The AC-4 Audio will have a weird sample rate and we will need to
resample it
@gnattu gnattu marked this pull request as ready for review July 16, 2024 08:57
@gnattu
Copy link
Member Author

gnattu commented Jul 16, 2024

I think this is ready for merge now.

Copy link
Member

@nyanmisaka nyanmisaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YOLO

@gnattu gnattu merged commit 9553f9b into jellyfin Jul 16, 2024
25 checks passed
@gnattu gnattu deleted the test-add-ac4 branch July 16, 2024 12:18
@Gauvino
Copy link
Contributor

Gauvino commented Jul 16, 2024

The documentation needs to ne update too no ?

@williamthrilliam
Copy link

Holy crap! How do I get this? Has it been merged into the jellyfin-ffmpeg6 ppa?

@gnattu
Copy link
Member Author

gnattu commented Jul 20, 2024

AC-4 audio might carry weird sample rate that most audio encoders will reject/works incorrectly so if you want to use it in CLI to convert audio you probably will want to resample it with a common sample rate like -ar 48000.

To get a deb for ffmpeg builds contains this change, you can download artifacts from here:

https://github.com/jellyfin/jellyfin-ffmpeg/actions/runs/9956706273

If you want to use this with jellyfin server then it is useless without the server changes, which has no published builds yet. It will come in this week's unstable build, where you can get from repo.jellyfin.org

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable To Decode ATSC 3.0 AC-4 Audio
5 participants