We need to separate the used codec and the file extension. Since, if a file is returned as MP4 it still can have a FLAC encoded audio channel, but the container is indeed an MP4 container.
What happens here is, if stream has ".mp4" in it's file name, the lines above try to check the used codec and wrongly adapt the file extension. To overcome this problem problem I propose solely rely on the extension within the URL. I have a problem which is related to this https://github.com/exislow/tidal-dl-ng/issues/232
A lot of debugging led me to this conclusion. I will propose a solution with a PR.
I did some research and found out that this behavior is wrong: https://github.com/tamland/python-tidal/blob/1720a0bcb7b2ec1d935ca11b366eba1d1655d459/tidalapi/media.py#L619-L637
We need to separate the used codec and the file extension. Since, if a file is returned as MP4 it still can have a FLAC encoded audio channel, but the container is indeed an MP4 container.
What happens here is, if stream has ".mp4" in it's file name, the lines above try to check the used codec and wrongly adapt the file extension. To overcome this problem problem I propose solely rely on the extension within the URL. I have a problem which is related to this https://github.com/exislow/tidal-dl-ng/issues/232
A lot of debugging led me to this conclusion. I will propose a solution with a PR.