MartinEesmaa / VVCEasy

VVCEasy is that you don't have to compile or/and coding to encode VVC (known as Versatile Video Codec). Simple. Easy. Encode. Decode
https://martineesmaa.org/en/vvceasy
MIT License
145 stars 15 forks source link

MPV build with xHE-AAC decoding capability #17

Closed ZenKiyoshi closed 1 year ago

ZenKiyoshi commented 1 year ago

This is not an issue, this is a request to make MPV build can decode xHE-AAC codec along with VVC. It's not purpose of VVCEasy project, so you feel free to ignore this request completely.

In the case you are interested in:

xHE-AAC or USAC is new audio codec and like VVC's situation, there are no any video players can play it yet. At the moment, the only way to decode xHE-AAC is using foobar2000 with this pluging. Unfortunately, foobar200 is music player only and it can't play video.

K-Lite Codec Pack (Media classic player pack) when asked, they said will wait untill FFmpeg implement decoder. That's 2 years ago, and no thing happen.

The reason why many video players are hesitant may be licence problem, I don't know.

About encoder, you can find free, open source xHE-AAC encoder, Exhale here:

mp4box (dev nightly) can mux VVC video and xHE-AAC audio into mp4 container.

To implement xHE-AAC decoder in MPV, you need libfdk-aac. There is a picture of MPV shows that, libfdk-aac is used to decode, but I don't download and don't remember where the picture is.

You may want to ask mr fan or aac fan, admin of AAC discord channel: https://discord.gg/4JmXD9qx . He is a Fraunhofer's staff (I think so, not sure), he knows how to do it.

xHE-AAC examples: https://drive.google.com/drive/folders/1cH7O2p_st1aVvHxWtVPppwTsrrfC8g5x?usp=sharing https://www2.iis.fraunhofer.de/AAC/xhe-aac-compare-tab2.html

MartinEesmaa commented 1 year ago

@ZenKiyoshi, thank you for your response request! Sorry for late answer.

I know why foobar2000 is the only music player, but xHE-AAC sdk decoder of foobar2000 is an open source. K-Lite Codec Pack did nothing happened to add xHE-AAC decoder on it :(.

I already know about xHE-AAC, because I have a problem with license. I decided to ask MPEG LA for patent license or I ask an evaluation license of Fraunhofer, if possible to get source code of xHE-AAC.

I already tried to play VVC with xHE-AAC of my libfdk-aac enabled, but audio did not work only. Some xHE-AAC audios needs to play of FFmpeg using implemented libfdk-aac.

On Android, here's what I found xHE-AAC decoder open source, see the file: https://android.googlesource.com/platform/external/aac/+/refs/heads/master/libMpegTPDec/src/tpdec_asc.cpp

I found an open source music player, that can play xHE-AAC audio with Android MediaPlayer API: https://github.com/enricocid/Music-Player-GO https://github.com/enricocid/Music-Player-GO/blob/main/FORMATS.md

Screenshot: xheaacandroidexternal

I can't join to Discord, because the invite is invalid.

Sincerely

ZenKiyoshi commented 1 year ago

I can't join to Discord, because the invite is invalid.

It expired, another invitation: https://discord.gg/ZcrpYphw

ZenKiyoshi commented 1 year ago

I have built ffmpeg with enabling vvdec and libfdk_aac. https://drive.google.com/file/d/1m55kTqWRyoV8QTNt3Ve7rjwnqmpzHqdP/view?usp=sharing

It can decode xHE-AAC ffmpeg -c:a libfdk_aac -i "xhe-acc-file.m4a"

Untitled

You must place -c:a libfdk_aac before input.

With vvdec, ffplay can play xHE-AAC file alone. ffplay -codec:a:1 libfdk_aac "xhe-aac-file.m4a"

or VVC with xHE-AAC in mp4 container. ffplay -codec:a:1 libfdk_aac "VVC_with_xHE-AAC_muxed.mp4"

You also place -codec:a:1 before input

ffplay play mp4 file with lagging video and miss sync with audio. I may not build vvdec properly. If I use ffmpeg pipe to mpv, video syncs with audio properly. ffmpeg -c:a: libfdk_aac -i "VVC_with_xHE-AAC_muxed.mp4" -c:a pcm_s32le -f wav -c:v copy -f nut - | mpv-vvceasy - because of mpv can't decode xHE-AAC, I encode audio to pcm.

I build using MSYS2, I hope your system can run it.

MartinEesmaa commented 1 year ago

You're right, @ZenKiyoshi! Thank you so much! You're rock, but mpv-vvceasy and ffplay that I can't seek duration.

ZenKiyoshi commented 1 year ago

thank aac fan for telling me that, I need place -c:a libfdk_aac before input. If not, no way I know.

but mpv-vvceasy and ffplay that I can't seek duration.

ffplay can seek by right mouse click, but due to lagging playback, it's not good anyway.

With pipe method, there is no way.

Now, just need a mpv build with xHE-AAC decoder implementation. Can you write a tutorial how to build using MSYS2 or crossing compile, I'm so frustrating to try compile MPV. Compiling MPV is more difficult than compile ffmpeg.

MartinEesmaa commented 1 year ago

Finished!