DeaDBeeF-Player / deadbeef

DeaDBeeF Player
https://deadbeef.sourceforge.io/
Other
1.59k stars 174 forks source link

Fragmented AAC MP4 (dash ftyp) support #1663

Open cipricus opened 7 years ago

cipricus commented 7 years ago

This doesn't happen with all m4a files. I do not have too many such files to be able to compare a lot, what I have are audio files that all come from Youtube, downloaded directly as m4a audio files or extracted without conversion from mp4 video files (with a command like 'ffmpeg -i video.mp4 -vn -acodec copy audio.m4a').

Deadbeef can play directly (as audio-only) the mp4 (video) files; the m4a extracted with the above command from those mp4 videos can be played by db.

Deadbeef cannot play the m4a downloaded from youtube as m4a audio with the program SMTube. (Some more details on that program action: http://unix.stackexchange.com/a/229812/32012). I think this program captures the stream through youtube-dl, then uses uGet to download if that is installed.

Trying another program that can download m4a directly from youtube, MPS (http://www.webupd8.org/2014/03/command-line-youtube-player-mps-youtube.html) I get m4a files that can be played by deadbeef.

So, there must be something wrong with those files that are downloaded by SMTube.

But ALL other players that I have tested (Audacious, Clementine, VLC, MPV) can play the incriminated files(s) and also I would very much prefer to keep using the SMTube program for the mentioned purpose.

Tested this on db 0.7.2, also on master and the older 0.5.4.

I will also send by mail the links with samples for the mentioned files.

Oleksiy-Yakovenko commented 7 years ago

Thanks for the bug report, please send one example file to me, and we'll figure it out.

cipricus commented 7 years ago

I have sent two versions of the same m4a/aac audio, one working and one not.

cipricus commented 7 years ago

Also, even the mp4 video files downloaded by SMTube (that is, through uGet) can be played by Deadbeef.

cipricus commented 7 years ago

This is not limited to SMTube: I have tested other method of directly downloading the youtube audio (using Flashgot addon in Firefox, details on the above stackexchange link) and it gets an aac file that cannot be played in db.

Oleksiy-Yakovenko commented 7 years ago

The file that doesn't play is very special. It doesn't contain the information, that's normally expected from mp4 aac files, and the info in the file says that it's 0 length.

However, the file contains mp4 atom called "sidx", which deadbeef does not recognize, and I'm trying to find out what this atom supposed to contain.

It seems to be a fragmented mp4 stream, and indeed the file contains multiple moof atoms.

It will take some work to make this play.

Oleksiy-Yakovenko commented 7 years ago

I'm not sure whether the current linux builds of deadbeef include ffmpeg with AAC support, but you could add M4A to the ffmpeg plugin file extension list (in the UI), and then try loading the file again.

This works for me on macOS, the file plays, but the whole player freezes if I try to seek in the file.

When I have time, I will try to add sidx/moof support to mp4ff, and write a native demuxer for fragmented mp4 files, but this would take several days of my time, and I don't know when I have that.

Oleksiy-Yakovenko commented 7 years ago

For the reference, the atoms like sidx are documented here

cipricus commented 7 years ago

Adding m4a in the ffmpeg player plugin list of extensions, it still doesn't work.

(Checking "Use all extensions supported by ffmpeg" makes db unable to play all files!)

Oleksiy-Yakovenko commented 7 years ago

Checking "Use all extensions supported by ffmpeg" makes db unable to play all files!

yeah, I know.. this is why it's off by default.

it works in some ffmpeg versions, and doesn't in others..

kybos commented 7 years ago

Adding m4a in the ffmpeg player plugin list of extensions seems to work perfectly for me (even seeking). Ubuntu 16.04

kybos commented 7 years ago

Could be helpful: https://github.com/rg3/youtube-dl/issues/3681

wdlkmpx commented 7 years ago

I also noticed deadbeef doesn't play m4a files downloaded from youtube. however if i change the extension to .aac it does play them.

interesting that using the ffmpeg player works. it would also be interesting to compile a deadbeef that only uses ffmpeg to see how small it can be. maybe following mplayer's style: download and compile a specific version of ffmpeg and with a specific config..

Oleksiy-Yakovenko commented 7 years ago

I also noticed deadbeef doesn't play m4a files downloaded from youtube. however if i change the extension to .aac it does play them.

It's because in this case deadbeef ignores the container, and just finds the AAC frames directly in the stream. It's fairly "fail-proof", so sometimes the mp4 files could successfully play through "raw-aac" code path.

it would also be interesting to compile a deadbeef that only uses ffmpeg to see how small it can be.

Deadbeef is modular. You can see the size of each individual plugin (including ffmpeg).

cipricus commented 7 years ago

Testing again with 0.7.2 in Solus Linux, I can confirm that adding m4a in the ffmpeg player plugin list of extensions fixes it for me too. https://github.com/Alexey-Yakovenko/deadbeef/issues/1663#issuecomment-260190082