dash mp4: bitrate 0
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
Can you provide an example file somehow (or send it to me [email protected]) ?
sure ill send you a couple via mail
sent!
btw they were created via https://github.com/ritiek/spotify-downloader, which also uses mutagen
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.
ok, sidx just has offsets. using tfhd+trun works though..., see ISO_IEC_14496-12_2012
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.
thanks for looking into it! Will report it to them.