Request - Limit Sample Rate on 24/96kHz FLAC -> MP3 Transcodes

Plex Media Server 0.9.16.3

Can the sample rate be limited when transcoding HD FLAC files? I’m running into an issue playing 24/96kHz FLAC files in the Plex web interface. I assume this issue will arise on any device which doesn’t natively support FLAC.

Mar 24, 2016 11:07:47 [0x7fd7597fd700] DEBUG - Updating part with ID=68846 [/data/audio/vinyl/Ween - 1992 - Pure Guava [FLAC 24.96]/01 Little Birdy.flac]
Mar 24, 2016 11:07:47 [0x7fd7597fd700] DEBUG - It took 0.0 sec to serialize a list with 1 elements.
Mar 24, 2016 11:07:47 [0x7fd767bfe700] DEBUG - Completed: [127.0.0.1:35116] GET /library/metadata/53650 (14 live) GZIP 6ms 965 bytes 200
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - MDE: analyzing media item 68845
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - MDE: Little Birdy: Direct Play is disabled
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - MDE: Little Birdy: no direct play music profile exists for http/flac/flac
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - MDE: Little Birdy: selected media 0 / 68845
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - Cleaning directory for session w0t6qgeogm2f0f6r ()
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - Starting a transcode session w0t6qgeogm2f0f6r at offset -1.0 (state=2)
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - [Universal] Using local file path instead of URL: /data/audio/vinyl/Ween - 1992 - Pure Guava [FLAC 24.96]/01 Little Birdy.flac
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - TranscodeJobManager: [Running] onTranscodeSessionStarted: w0t6qgeogm2f0f6r
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - TranscodeJobManager: [Running] -> [Throttled]
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - Job running: XDG_CACHE_HOME='/var/lib/plex/Plex Media Server/Cache/' XDG_DATA_HOME='/opt/plexmediaserver/Resources/' '/opt/plexmediaserver/Resources/Plex New Transcoder' '-i' '/data/audio/vinyl/Ween - 1992 - Pure 
Guava [FLAC 24.96]/01 Little Birdy.flac' '-map' '0:0' '-codec:0' 'libmp3lame' '-ar:0' '96000' '-channel_layout:0' 'stereo' '-q:0' '2' '-f' 'mp3' '-avoid_negative_ts' 'disabled' '-map_metadata' '-1' '-map_chapters' '-1' '-' '-start_at_zero' '-copyts' '-y' '-no$
tats' '-loglevel' 'quiet' '-loglevel_plex' 'error' '-progressurl' 'http://127.0.0.1:32400/video/:/transcode/session/w0t6qgeogm2f0f6r/progress'
Mar 24, 2016 11:07:47 [0x7fd765bff700] INFO - [Transcoder] Input #0, flac, from '/data/audio/vinyl/Ween - 1992 - Pure Guava [FLAC 24.96]/01 Little Birdy.flac':
  Metadata:
    track           : 1
    ALBUM           : Pure Guava
    DATE            : 1992
    TITLE           : Little Birdy
    ARTIST          : Ween
  Duration: 00:03:29.87, start: 0.000000, bitrate: 3184 kb/s
    Stream #0:0, 120, 1/96000: Audio: flac, 96000 Hz, stereo, s32 (24 bit)
    Stream #0:1, 1, 1/90000: Video: png, rgba(pc), 1200x1200 [SAR 2835:2835 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      comment         : Cover (front)
      title           : front.png
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG -  [FFMPEG] Duration: 209
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - Read line, and done: 1
Mar 24, 2016 11:07:47 [0x7fd758ffc700] DEBUG - Started session successfully: w0t6qgeogm2f0f6r
Mar 24, 2016 11:07:47 [0x7fd766bff700] DEBUG - Started universal transcode output thread
Mar 24, 2016 11:07:47 [0x7fd759ffe700] ERROR - [Transcoder] [libmp3lame @ 0x2be5300] Specified sample rate 96000 is not supported
Mar 24, 2016 11:07:47 [0x7fd7597fd700] INFO - [Transcoder] Output #0, mp3, to 'pipe:':
  Metadata:
    plex.duration   : 209.871
    plex.total_duration: 209.871
    Stream #0:0, 0, 0/0: Audio: mp3, 0 channels, 128 kb/s
    Metadata:
      encoder         : Lavc56.41.100 libmp3lame
Mar 24, 2016 11:07:47 [0x7fd765bff700] ERROR - [Transcoder] Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Mar 24, 2016 11:07:47 [0x7fd759ffe700] ? - [Transcoder] 
Mar 24, 2016 11:07:47 [0x7fd766bff700] DEBUG - Universal transcode session finished reading output.
Mar 24, 2016 11:07:47 [0x7fd766bff700] DEBUG - Finished universal transcode output thread

It’s apparent that the sample rate of the FLAC file is passed directly into ffmpeg and piped into the LAME. LAME is having issues with the file’s sample rate, so it throws an error and moves on.

Attempting a similar command directly (96000), throws the same error:

ffmpeg -i /data/audio/vinyl/Ween\ -\ 1992\ -\ Pure\ Guava\ \[FLAC\ 24.96\]/01\ Little\ Birdy.flac  -map 0:0 -codec libmp3lame -ar 96000 -channel_layout stereo -q 2 -f mp3 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 - -start_at_zero -copyts -y

while adjusting the sample rate (48000), works as expected:

ffmpeg -i /data/audio/vinyl/Ween\ -\ 1992\ -\ Pure\ Guava\ \[FLAC\ 24.96\]/01\ Little\ Birdy.flac  -map 0:0 -codec libmp3lame -ar 48000 -channel_layout stereo -q 2 -f mp3 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 - -start_at_zero -copyts -y

I guess for a follow up question: Is this configurable anywhere? It’d be nice to also configure the transcode bitrate.

And actually, now that I’m playing through some other media, this seems to be a recent issue. There are other 24/96 albums I know have successfully transcoded in the web interface in the past.

Seems to be related to another post thread I was on: http://forums.plex.tv/discussion/211181/flac-files-do-not-play-from-media-server#latest

And I concur, after last week’s update (0.9.16.2 I believe) I could no longer play any of my FLAC files.

@jonesy16 said:
Seems to be related to another post thread I was on: http://forums.plex.tv/discussion/211181/flac-files-do-not-play-from-media-server#latest

Slightly different, but I wonder if the root cause is similar. I can play FLAC files fine, as long as the sample rate is <= 48kHz.

Could be, most, if not all, of my FLAC files have a high sample rate.

This has been resolved with release: Plex Media Server 0.9.16.4. Thanks dev team!