mutagen icon indicating copy to clipboard operation
mutagen copied to clipboard

dash mp4: bitrate 0

Open razaqq opened this issue 7 years ago • 7 comments

import mutagen

f = mutagen.File("filename.m4a")
print("Length: {}s; Bitrate: {}; Sample Rate: {}; Bits per Sample: {}".format(f.info.length, f.info.bitrate, f.info.sample_rate, f.info.bits_per_sample))

output:

Length: 342.12281179138324s; Bitrate: 0; Sample Rate: 44100; Bits per Sample: 16

I tried on a lot of different files, always getting bitrate 0

razaqq avatar Dec 21 '18 15:12 razaqq

Can you provide an example file somehow (or send it to me [email protected]) ?

lazka avatar Dec 21 '18 15:12 lazka

sure ill send you a couple via mail

razaqq avatar Dec 21 '18 15:12 razaqq

sent!

btw they were created via https://github.com/ritiek/spotify-downloader, which also uses mutagen

razaqq avatar Dec 21 '18 15:12 razaqq

Thanks.

Hm, it's a DASH file, and the bitrate in the file is set to 0 (unknown).

I see there is a sidx atom which contains a list of segment sizes and in the tkhd atom there is a track ID to match that. Maybe we can calculate the bitrate from there.

lazka avatar Dec 21 '18 20:12 lazka

ok, sidx just has offsets. using tfhd+trun works though..., see ISO_IEC_14496-12_2012

lazka avatar Dec 22 '18 10:12 lazka

ok, for reference, one can get these types of files through

youtube-dl --fixup never -f 140 "https://www.youtube.com/watch?v=j5oaCPCqN3Y"

youtube-dl will by default convert the dash files to normal mp4 files: https://github.com/rg3/youtube-dl/blob/d4a24f4091a622b808ff621e78b5cfd0db3c8c11/youtube_dl/postprocessor/ffmpeg.py#L520

You should report this to spotify-downloader as it likely will cause incompatibilities with various software.

lazka avatar Dec 22 '18 10:12 lazka

thanks for looking into it! Will report it to them.

razaqq avatar Dec 25 '18 09:12 razaqq