Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Question mark for duration on alot of AAC files (Read 2589 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Question mark for duration on alot of AAC files

Hi,

I just noticed that foobar2000 doesnt display the duration for alot of my aac files (and also no bitrate information etc.), also the progressbar/slider is missing/not working:




while e.g. vlc and winamp show it (though with contradicting lengths):
vlc:

winamp:



i think it affects all .aac files i downloaded with jdownloader (e.g. from youtube - i think it uses ffmpeg to convert the video to aac).
it might be a missing header/information or something as the duration seems to be some fallback logic - atleast in vlc i can see the time jumping between 3:53-3:59 several times when i start the track until it "settles" at 3:56 after 1-2 seconds - and winamp displays 3:59 as duration but in format information it says "234 Seconds" which would be 3:54 and the player stops at 3:56 :D (though this could be a silence remover plugin ive installed).
ive attached one of the files which is affected.

Greets
Silver

EDIT:
i just confirmed that this happens with all aac files downloaded with jdownloader from youtube. maybe a problem in jdownloaders conversion? however some fallback logic which calculates the duration of the file based on the data size / bitrate and allowing seeking through it would be nice.

Re: Question mark for duration on alot of AAC files

Reply #1
I assume this is because the files are raw AAC streams and aren't in a container like M4A. Pretty sure the container holds the duration info for the player.

I might be wrong - but it's a starting point.

C.
PC = TAK + LossyWAV  ::  Portable = Opus (130)

Re: Question mark for duration on alot of AAC files

Reply #2
There was proper support for these ADTS streams several years ago in older foobar2000 series. But those files got rare and Peter wanted to simplify the decoder and stipped away the extra code required to parse the lengths and build seektables.

Best solution is to put the files inside MP4 containers and give them .m4a extension. This can be done with for example ffmpeg.
Another option is to use foo_input_ffmpeg with foobar2000 v1.4 series. You can make ffmpeg input preferred over native AAC handler and configure *.AAC to be decoded with ffmpeg.

Re: Question mark for duration on alot of AAC files

Reply #3
Converting all affected files would be waaay to much work...

i tried the ffmpeg decoder:
configured it to handle aac files:

and set it to top of decoder invoking order:

but no difference at all - is there anything else i need to do, or a way to check if it is using ffmpeg?

EDIT:
just opened the console - it says:
Quote
Launching ffprobe:
"D:\Program Files\ffmpeg\bin\ffprobe.exe" -of xml -show_format -show_streams -show_chapters -hide_banner "<...path...>\TroyBoi - No Substitute ft. Y.A.S (256 kbit_s).aac"
Launching ffmpeg:
"D:\Program Files\ffmpeg\bin\ffmpeg.exe" -i "<...path...>\TroyBoi - No Substitute ft. Y.A.S (256 kbit_s).aac" -map 0:0 -f w64 -acodec pcm_f32le -
so ffmpeg seems to be running.
i quickly ran the ffprobe command via cmd which outputs:
Code: (xml) [Select]
<?xml version="1.0" encoding="UTF-8"?>
<ffprobe>
[aac @ 000001536d1bcb80] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from '<...path...>\TroyBoi - No Substitute ft. Y.A.S (256 kbit_s).aac':
  Duration: 00:04:03.79, bitrate: 246 kb/s
    Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 246 kb/s
    <streams>
        <stream index="0" codec_name="aac" codec_long_name="AAC (Advanced Audio Coding)" profile="LC" codec_type="audio" codec_time_base="1/44100" codec_tag_string="[0][0][0][0]" codec_tag="0x0000" sample_fmt="fltp" sample_rate="44100" channels="2" channel_layout="stereo" bits_per_sample="0" r_frame_rate="0/0" avg_frame_rate="0/0" time_base="1/28224000" duration_ts="6880770114" duration="243.791458" bit_rate="246339">
            <disposition default="0" dub="0" original="0" comment="0" lyrics="0" karaoke="0" forced="0" hearing_impaired="0" visual_impaired="0" clean_effects="0" attached_pic="0" timed_thumbnails="0"/>
        </stream>
    </streams>

    <chapters>
    </chapters>

    <format filename="<...path...>\TroyBoi - No Substitute ft. Y.A.S (256 kbit_s).aac" nb_streams="1" nb_programs="0" format_name="aac" format_long_name="raw ADTS AAC (Advanced Audio Coding)" duration="243.791458" size="7506918" bit_rate="246339" probe_score="51"/>
</ffprobe>
which seems to be also contradicting statements to the other players info... "Duration: 00:04:03.79, bitrate: 246 kb/s", 'duration="243.791458" bit_rate="246339"'.
However foobar2000/the ffmpeg component seems to ignore these infos anyway, as it still displays a question mark and no seekbar.

Re: Question mark for duration on alot of AAC files

Reply #4
Converting all affected files would be waaay to much work...

First, you should not "convert" in the "decode/encode" sense. You should remux (a.k.a. "re-encapsulate")
Like for example ffmpeg -i yourmusicfile.aac -acodec copy yourmusicfile.m4a [oh, btw: check if your ffmpeg version is willing to use ".m4a")

Second: you can run a FOR loop from your "top music directory", that will traverse all .aac files and put them in mp4 containers. Then you can afterwards copy tags if necessary, bit-compare to check that you have not lost any music, and then delete your .aac's - or tell fb2k to ignore them.

Re: Question mark for duration on alot of AAC files

Reply #5
as i said - to much work - im not going to remux all my aac files (and do this for all future aac files) and handle duplicate files, etc. just because fb2k cant handle aac files correctly while virtually every other player can (just checked, even windows mediaplayer works).
guess ill just ignore it or switch back to winamp if theres no reasonable solution.

Re: Question mark for duration on alot of AAC files

Reply #6
You can use a proper YouTube ripper like youtube-dl, which outputs MP4 or Ogg Opus, depending on the video you rip. Mass encapsulation can be automated as well.

Re: Question mark for duration on alot of AAC files

Reply #7
You need to reload info for files after you switch to FFmpeg decoder. It will otherwise show cached info from the time length wasn't known. Also you don't need to have both upper case and lower case aac in the extension list. The match isn't case sensitive.

Re: Question mark for duration on alot of AAC files

Reply #8
You need to reload info for files after you switch to FFmpeg decoder. It will otherwise show cached info from the time length wasn't known. Also you don't need to have both upper case and lower case aac in the extension list. The match isn't case sensitive.

woot, thought restarting the player would be enough.
thank you very much, this works fine :)
yes, guessed that it wasnt case sensitive, however the doc didnt explicitly say its case insensitive, so i just put both in :P

EDIT:
however looks like ffmpeg gets wrong kbit/s rates, e.g. 246 when its 256 or 198 for 192.
no idea why this happens and the time is off by a few seconds cause of that - however seekbar works (except last few seconds) and total time is just off by a few seconds which is fine for me.

Re: Question mark for duration on alot of AAC files

Reply #9
as i said - to much work

Probably less than posting here.
for /R %f IN (*.aac) do ffmpeg -i "%f" -acodec copy "%f.m4a"
should do it. Then the new files will have .aac.m4a suffix, and using fb2k's library you can easily find, align and bitcompare.