[Solved] Transcoding FLAC from network drive (NAS)

Need help? Post your questions here.

Moderator: moderators

[Solved] Transcoding FLAC from network drive (NAS)

Postby dmaloir » Fri Apr 07, 2017 8:37 pm

Hello everyone,
I've recently hit an issue for which I can't find any solution and I would welcome any help from this forum!

Context: Until recently, I had a home debian server with subsonic which ran flawlessly. I now have a NAS on which I'm running a debian virtual machine (VM) and intend to use the latter to stream music.
NAS: QNAP TS-563, AMD x86 G-Series Quad-core 2.0 GHz, 16Gb Ram, 4x3TB raid5 + SSD Cache.
VM: Debian 8.7.1 x64, 4Gb dedicated RAM, 50Gb hdd. Music library is hosted in a 'Music' folder on the NAS itself. The folder is mounted at boot by the VM. This allows me to keep the VM small, and to centralize the music library on the NAS for other purposes. To be clear: the VM is hosted on the NAS and gets its music from the same NAS through a virtual network (not sure if this may be of importance).
For completeness, here's how the library is mounted: //xxx.xxx.xxx.xxx/Data/Music /media/music cifs credentials=/root/.smbcredentials,nounix,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

Subsonic: started with stable version 6.0, had the issue described hereafter, then updated to 6.1.beta2 (build dc75a2) – March 20, 2017 with no luck.

Problem Description:
I have issues with FLAC transcoding:
  • The songs would stop halfway and skip to the next in queue
  • Next song in queue would not start
  • Sudden sound distortions would be heard, followed by the music stopping than restarting

Troubleshooting Steps:
  • First of all, the music library is the same as what I used before on my server and which worked without problem. I therefore do not believe there is an issue with the music files themselves.
  • Next, as said before, I tried to update to the latest Subsonic version (I already knew the issue would not be there... but it was the easiest fix to do first).
  • I installed removed ffmpeg and replaced it with a symlink to a new version, installed though apt-get. This did not change a thing.
  • I noticed the option 'fast-access', apparently aimed at network drives. No improvement.
  • I found https://wiki.archlinux.org/index.php/Subsonic and other links which propose alternative transcoders. I therefore installed flac and lame and tried to implement them. It would sometimes work but usually I got very similar issues than with ffmpeg. One additional issue I got was the impossibility to skip within a song, as it would automatically play the next one in queue instead.
  • I came back to a previous snapshot of the VM and installed Madsonic for the heck of it, and I got identical results. It was clear the issue was not there.
  • I then copied a few flac files from the NAS to the home directory of the VM and, lo and behold, it worked perfectly. The queue was neatly handled, skipping within a song worked like a charm. I think, at that time, I was still using the flac -> lame transcoder.
  • I switched back to the library on the NAS without changing a thing and I got all the playback issues back again.
  • I removed the "nounix" parameter in the mounting of the network share. I thought maybe that was superfluous and noticed some improvements. Things improved significantly for the Ffmpeg transcoder which now runs mostly well. After some time, however, it would stop in the middle of a song and just be stuck, or drop a nice sound distortion through the speakers. Skipping within a track seems to be ok.

It seems quite clear to me that the issue come from the fact that the media library is located on a network drive. I would therefore be highly interested in similar experiences from fellow Subsonic users.
Thank you for your help!

Playback Application and version:
Playback on web player through Firefox 52.0.2 (32 bits)

Output from ffmpeg -i + flac filename:
Code: Select all
ffmpeg -i "01. Your Turn.flac"
ffmpeg version 3.2.4-1~bpo8+1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-version='1~bpo8+1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --disable-libebur128 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 34.101 / 55. 34.101
  libavcodec     57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter     6. 65.100 /  6. 65.100
  libavresample   3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample   2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
Input #0, flac, from '01. Your Turn.flac':
  Metadata:
    ARTIST          : Typh Barrow;Typh Barrow
    ALBUM           : Time;Time
    TITLE           : Your Turn;Your Turn
    GENRE           : Pop;Pop
    encoder         : FLAC.EXE -6 -V -T "ARTIST=Typh Barrow" -T "TITLE=Your Turn" -T "ALBUM=Time" -T "DATE=2014" -T "TRACKNUMBER=01" -T "GENRE=Pop" -T "COMMENT=" -T "BAND=" -T "ALBUMARTIST=" -T "COMPOSER=" -T "DISCNUMBER=1" -T "TOTALDISCS=1" -T "TOTALTRACKS=8" -o
    TLEN            : 218973
    track           : 01
    encoded_by      : Exact Audio Copy   (Secure mode)
    DATE            : 2014;2014
    disc            : 1
    TOTALDISCS      : 1
    TOTALTRACKS     : 8
  Duration: 00:03:38.97, start: 0.000000, bitrate: 860 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, stereo, s16


Last few log file lines: It's intersting to note that a file which bugged with flac->mp3 went fine with Ffmpeg.
Code: Select all
[4/7/17 9:57:25 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/flac --silent --decode --stdout /media/music/Norah Jones/Not Too Late/03. The Sun Doesn't Like You.flac
[4/7/17 9:57:25 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/lame --silent -h -b 320 -
[4/7/17 9:57:32 PM CEST]    INFO   InputStreamReaderThread   (/var/subsonic/transcode/flac) 03. The Sun Doesn't Like You.flac: *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
[4/7/17 9:57:32 PM CEST]    INFO   InputStreamReaderThread   (/var/subsonic/transcode/flac) *** Got error code 0:FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC
[4/7/17 9:57:32 PM CEST]    INFO   InputStreamReaderThread   (/var/subsonic/transcode/flac)
[4/7/17 9:57:32 PM CEST]    INFO   InputStreamReaderThread   (/var/subsonic/transcode/flac) 03. The Sun Doesn't Like You.flac: ERROR while decoding data
[4/7/17 9:57:32 PM CEST]    INFO   InputStreamReaderThread   (/var/subsonic/transcode/flac) state = FLAC__STREAM_DECODER_READ_FRAME
[4/7/17 10:00:31 PM CEST]    DEBUG   StreamController   GET /stream?player=2&id=3555&auth=916626686&scrobble=false, Range: bytes=0-
[4/7/17 10:00:31 PM CEST]    DEBUG   StreamController   Content-Length: 7160000
[4/7/17 10:00:31 PM CEST]    DEBUG   StreamController   Content-Range: 0-7159999/7160000
[4/7/17 10:00:31 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/ffmpeg -i /media/music/Norah Jones/Not Too Late/03. The Sun Doesn't Like You.flac -map 0:0 -b:a 320k -v 0 -f mp3 -
[4/7/17 10:01:24 PM CEST]    DEBUG   StreamController   GET /stream?player=2&id=3554&auth=58573682&scrobble=false, Range: bytes=0-
[4/7/17 10:01:24 PM CEST]    DEBUG   StreamController   Content-Length: 9440000
[4/7/17 10:01:24 PM CEST]    DEBUG   StreamController   Content-Range: 0-9439999/9440000
[4/7/17 10:01:24 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/ffmpeg -i /media/music/Norah Jones/Not Too Late/04. Until the End.flac -map 0:0 -b:a 320k -v 0 -f mp3 -
[4/7/17 10:05:20 PM CEST]    DEBUG   StreamController   GET /stream?player=2&id=3553&auth=1252159028&scrobble=false, Range: bytes=0-
[4/7/17 10:05:20 PM CEST]    DEBUG   StreamController   Content-Length: 6960000
[4/7/17 10:05:20 PM CEST]    DEBUG   StreamController   Content-Range: 0-6959999/6960000
[4/7/17 10:05:20 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/ffmpeg -i /media/music/Norah Jones/Not Too Late/05. Not My Friend.flac -map 0:0 -b:a 320k -v 0 -f mp3 -
[4/7/17 10:07:14 PM CEST]    WARN   CoverArtController   Failed to process cover art /media/music/Katie Melua/The House/Katie Melua - The House.jpg: java.lang.NullPointerException
[4/7/17 10:08:15 PM CEST]    DEBUG   StreamController   GET /stream?player=2&id=3552&auth=1225150390&scrobble=false, Range: bytes=0-
[4/7/17 10:08:15 PM CEST]    DEBUG   StreamController   Content-Length: 8000000
[4/7/17 10:08:15 PM CEST]    DEBUG   StreamController   Content-Range: 0-7999999/8000000
[4/7/17 10:08:15 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/ffmpeg -i /media/music/Norah Jones/Not Too Late/06. Thinking About You.flac -map 0:0 -b:a 320k -v 0 -f mp3 -
[4/7/17 10:11:35 PM CEST]    DEBUG   StreamController   GET /stream?player=2&id=3551&auth=741816700&scrobble=false, Range: bytes=0-
[4/7/17 10:11:35 PM CEST]    DEBUG   StreamController   Content-Length: 8040000
[4/7/17 10:11:35 PM CEST]    DEBUG   StreamController   Content-Range: 0-8039999/8040000
[4/7/17 10:11:35 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/ffmpeg -i /media/music/Norah Jones/Not Too Late/07. Broken.flac -map 0:0 -b:a 320k -v 0 -f mp3 - //NOTE//HERE, MUSIC STREAMING GOT STUCK AROUND HALFWAY TRHOUGH THE SONG
[4/7/17 10:17:39 PM CEST]    DEBUG   StreamController   GET /stream?player=2&id=3550&auth=1364772288&scrobble=false, Range: bytes=0-
[4/7/17 10:17:39 PM CEST]    DEBUG   StreamController   Content-Length: 8200000
[4/7/17 10:17:39 PM CEST]    DEBUG   StreamController   Content-Range: 0-8199999/8200000
[4/7/17 10:17:39 PM CEST]    INFO   TranscodeInputStream   Starting transcoder: /var/subsonic/transcode/ffmpeg -i /media/music/Norah Jones/Not Too Late/08. My Dear Country.flac -map 0:0 -b:a 320k -v 0 -f mp3 -
Last edited by dmaloir on Sat Apr 08, 2017 9:00 pm, edited 1 time in total.
dmaloir
 
Posts: 3
Joined: Fri Apr 07, 2017 7:07 pm

Re: Transcoding FLAC from network drive (NAS)

Postby dmaloir » Sat Apr 08, 2017 1:08 pm

New troubleshooting step:
I've modified the mount of the music library. It's now performed with nfs instead of cifs:
Code: Select all
192.167.1.12:/Data/Music /media/music nfs rw,exec 0 0


However the issue remains. Ffmpeg would get stuck in the middle of a song, or would seem to be done with a song but would not queue in the next one.
dmaloir
 
Posts: 3
Joined: Fri Apr 07, 2017 7:07 pm

Re: Transcoding FLAC from network drive (NAS)

Postby dmaloir » Sat Apr 08, 2017 8:59 pm

Trouble shooting steps:
Hrem ... my first postulate was definitely ill-advised.
At first, I had the impression that the streaming errors were random, but after a little bit of accounting, they seem to arise at the same place in the songs. Downloading the files on my pc and reading them with another software led to similar errors.
Therefore the files themselves are at fault.

It's likely the migration of the music library from the server to the NAS went wrong at some point. Purged and re-transferred my library, and it seems to be running fine.

This will teach me to cover all the bases from the beginning... :roll:
dmaloir
 
Posts: 3
Joined: Fri Apr 07, 2017 7:07 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 15 guests