Jump to content

FLAC transcoding (or not)


caroig

Recommended Posts

TLDR: When I download a FLAC album from my server or playlist to my Android phone transcoded to MP3, some downloaded files end up with the wrong extension (.flac) even though they are correctly transcoded to MP3 and because of that they won't play.  

Longer story: This issue seems to have been there for some time because I encountered this behaviour many times before. I keep most of my music in FLAC and when I download it to my Android phone, I choose transcoding to 128kbps or 192kbps. What I have been noticing for some time is that some files simply wouldn't play even though they showed downloaded in the Android app. Usually, I downloaded a playlist of my favorite songs (200-300 songs) I play them shuffled so if some songs got skipped I didn't notice. And when I did notice then e.g. some songs from an album wouldn't play, I just switched to streaming and soon forgot about the problem.

Recently my sister downloaded a full album to her new Android device, without tinkering with any settings (i.e. using the defaults) and complained she couldn't play the whole album, just a few individual songs. So I started investigating and discovered that in the /Android/data/com.mb.android/files/Download/Music/[Album_artist]/[Album_title] folder there was a mix of files with .mp3 and .flac extensions. However, the files with the .flac ending were .mp3 files internally, just with the wrong extension.

So I checked my device, I deleted all the downloaded music. And tried downloading at one moment just two files from an album and voila, one was with the correct .mp3 extension, but the other one had the .flac extension. I checked the corresponding log files on both the server and my Android device but didn't find what was wrong. On the server side, for both files, ffmpeg was triggered with the correct parameters, converting both FLAC files to MP3s with .mp3 extensions using some intermediary file name. The log from the Android app show that when I deleted en masse the previous playlist download, some file had .flac extension, some had the .mp3 extension. And as for the two files I test downloaded, the Android download manager was sent an instruction to download one file with the extension .mp3 and the other one with the extension .flac using Emby server API so it seems the rename with the wrong extension happens on the Android end... I'm attaching all relevant logs from both server, server transcode and the Android app. 

I'm running Emby server on Ubuntu 18.04 LTS, always the latest beta (currently 4.5.0.17),  always the latest beta (currently: 3.1.26). But as I wrote, it was happening before, on another Android phone and my sis had the same problem on another phone as well.

embyserver.txt ffmpeg-transcode-3d33d22f-d73e-4497-90ea-aa983297fcea_1.txt ffmpeg-transcode-15a9856a-99a8-4bf2-9d1a-5302cc7f7bb3_1.txt 6977871c-c5f2-4f02-aeac-d504be458dde.log 02_-_Lost_in_France.flac

Link to comment
Share on other sites

It would be better to have logs showing the problem happening vs deleting the wrong ones.

Any chance you could sync a new album and upload the same set of logs with the ffmpeg for any that end up as flac vs mp3?

This would help us identify where the problem actually happens.

Thanks!

Link to comment
Share on other sites

@cayars Thanks for your reply. There's both in the log files. After I deleted all previous syncs, I created a new sync, just two files from the same album to keep it simple. It's at the end of the embyserver.txt file. I didn't cut out the part where emby server was deleting all previous syncs because I thought it might help too. The two ffmpeg-transcode….txt log files are related to those two newly synced files, one was correctly named with .mp3 extension, the other has .flac extension but it's mp3 internaly (the related log for the erroneous one is: ffmpeg-transcode-3d33d22f-d73e-4497-90ea-aa983297fcea_1.txt). I included the transcoded file (with the wrong extension) as well.  

Edited by caroig
Link to comment
Share on other sites

Big log files get hard to read.

Any chance you could go to scheduled tasks, rotate the logs and sync something again then upload the server and ffmpeg logs?

Make life much easier for those reading it as there isn't lots of other data making noise in the files.

Carlo

Link to comment
Share on other sites

@cayars: I did so. Rotated the logs. Tried downloading another FLAC album. The result is as before. Some files downloaded correctly, some files ended up with the wrong extension (screenshots). I'm attaching the emby server  log, first two ffmpeg logs (I marked which extension they were downloaded with). Also log from my Android phone. Let me know if I can do some more tests to help find the culprit.

IMHO, the ffmpegs are OK. The files are correctly transcoded to mp3 and saved as some temp files with the correct extension. The Android app then asks for the downloaded file using emby API and some temp key and tells Android download manager to save it under a name with either FLAC or MP3 extension. I initiated the download from the Android device. 

Screenshot_20200814-091728.png

Screenshot_20200814-091742.png

embyserver.txt 091b222c-18b1-4cd7-8d2e-f898e0fe93e5.log FLAC - ffmpeg-transcode-ae7eb4a8-9f02-4c90-a52c-20748c9b3f3a_1.txt MP3 - ffmpeg-transcode-bb2b6539-f0cd-4dde-837f-9ceab6a19eff_1.txt

Edited by caroig
Link to comment
Share on other sites

@ebr can you take a look at this?  Looks like it's an Android issue.

Edited by cayars
Link to comment
Share on other sites

  • 1 month later...

I'm afraid I am. Just checked (some files were again converted to mp3 but downloaded with the .flac extension). I had simply started downloading all music as FLAC since there's a plenty of space on my phone so I didn't really check into this since posting my original reported. I'm on the latest Emby server beta for Linux and the latest Emby for Android beta. 

Link to comment
Share on other sites

  • 4 weeks later...

Just checking with Emby Server (on Ubuntu Budgie 20.04 LTS) version 4.5.2.0 (stable) and Emby for Android 3.1.14. Still broken, although the faulty files (transcoded correctly to mp3 but erroneously downloaded with FLAC extension) don't get downloaded at all. Only the correctly transcoded, correctly named files. 

I'm attaching the server log (rotated, with the debugging on). The FLAC album I was trying to download with the bitrate set to 128 kbps was Natalia Imbuglia's Left of the Middle.  

 

embyserver.txt

Link to comment
Share on other sites

  • 3 months later...

@caroig apologies for the delay. Are you still seeing this with the latest updates to both the server and android app? I cannot reproduce this.

How I tested this was I left the android app at it's default of 320k for the download setting. Then using the android app, I downloaded a flac song. It was converted to mp3 which I verified on the server.

Then after the download was complete, I used the google files app to check the file system and confirmed that it was in fact an mp3.

Please let us know if this helps. Thanks !

Link to comment
Share on other sites

Hey Luke. I've just tested downloading/converting with several albums and various bitrates and everything seems to be working perfectly. I'm on the latest Linux server beta and the latest Android client version.

Sorry for not testing this earlier. The thing is, I've been spending most days on home office ('coz Covid-19) and traveling very little so there was no need to download music to my device and the issue simply slipped my mind. 

Thank for reminding me and mainly and many thanks for fixing it!

 

 

 

Edited by caroig
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...