How do I transcode only FLACs?

Issue description:

Hi,

I am interested in only transcoding only my FLAC files to reduce the local media cache size of these files on my phone.

I cleared out my offline storage, set “Offline, Cache and Download” > Media > Offline cache and download quality to 320 kbps. I started the sync and saw all files were being transcoded, even lower bitrate ones are being upscaled. I was thinking anything 320 and lower would not be converted.

I tried doing this first on Jellyfin and I am now using LMS as a provider to see if it worked here but it hasn’t.

Logs:

Upload description: holycow131415

Additional information:

 

 

Reproduction steps:

 

 

Media provider:

Subsonic

Screenshots:

     

For LMS it’s up to the server what it do when bitrate is lower @itm ?

Only Jellyfin have a proper transcoding solution for now and should not transcode if there’s no bug there.

For both media providers, when I go into a song on the server that is already 320 and hit Offline cache and download button to cache it manually, the Quality is automatically on 320 kbps, when instead it should automatically be on “Original”

For LMS:

if symfonium only sets maxBitrate=320 (and does not provide format) in the stream API command, and if you did not enable transcoding by default in your lms’s settings, then your files should not be transcoded if their bitrate is below maxBitrate, whatever their format.

I can confirm the check box is unchecked for Enable transcoding by default in LMS.

In Symfonium I even have the Ignore server transcoding settings ticked in the media provider settings. Having it unticked too doesnt fix the issue either.

Could you switch lms logs to debug and check what happens there? You will see args in the stream endpoint + some internal logs on the decision process

Sorry, I dont see an option to enable logs in the LMS Settings. I dont actually know what any of that means.

Symfonium sends a format since it’s mandatory for nearly all servers.

Also remember that offline status will say that it was download with that settings, not that it’s actually transcoded or not.

I’m trying to push for a proper solution for OpenSubsonic but seing how it goes I doubt I’ll be able to have a proper API in OS.

Currently the files were definitely transcoded as they were larger mbs than original if upscaled or different than original if 320 to 320 happened.

In the case of LMS as @itm said it seems it’s normal as currently implemented like that. There’s no proper API to do better for now.

For Jellyfin again, only logs would tell what Jellyfin did say and returned when asked for the file.

If the actual file format is the same as the requested one and the file bitrate is lower than maxBitrate, no transcoding occurs.

But if the format is different, this is more questionable.

If the file is opus 128 and you request mp3 with maxBitrate=320, not sure which bitrate to pick. Currently lms just picks maxBitrate. It would need a codec quality comparison table to chose something else like 192.

Or the new proposed API :slight_smile: Symfonium by default request format opus and the maxbitrate configured depending on the action. Users can select to ask mp3 in provider settings too.

But there’s really the need for a proper API like all the other providers for all the different needs.

I just uploaded logs under holycow131415_jellyfin that might also have LMS logs too in them. So I think I see what’s happening. Jellyfin doesn’t have an option to transcode for mp3 like the subsonic media provider does. So JF is converting into opus which results in bigger files in the end, which is not really the point of wanting to transcode offline files. I flipped on mp3 for subsonic, and it seems like it skips lower bitrate mp3s like it’s supposed to.

I think the solution would be for an option to tick to only transcode flac, opus, or any other large file formats to mp3 as a storage saver option.

With all due respect don’t do supposition if you do not read the details I give each time :slight_smile:

  1. For LMS as said this is a limitation of the current API and a decision of LMS to transcode I’m trying to have a proper API build Add new transcoding extension by Tolriq · Pull Request #168 · opensubsonic/open-subsonic-api · GitHub but there’s friction around it and no one to backup me :wink:

  2. For Jellyfin this is as expected a “bug” in Jellyfin they take in account the image to calculate the bitrate of the media so your 320 kbps mp3 are seen as more than 320 and so Jellyfin transcode to reach the 320.

Example:
Extract: "SupportsDirectPlay": false, "Bitrate": 347052,

{
  "MediaSources": [
    {
      "Protocol": "File",
      "Id": "d8ab1f90c43b198066101729a02d468d",
      "Path": "/media/Music/Sevendust/Home (1999)/05 - Reconnect.mp3",
      "Type": "Default",
      "Container": "mp3",
      "Size": 9420564,
      "Name": "05 - Reconnect",
      "IsRemote": false,
      "ETag": "36e349a6722278a1e0300b90b9f0048c",
      "RunTimeTicks": 2171559180,
      "ReadAtNativeFramerate": false,
      "IgnoreDts": false,
      "IgnoreIndex": false,
      "GenPtsInput": false,
      "SupportsTranscoding": true,
      "SupportsDirectStream": false,
      "SupportsDirectPlay": false,
      "IsInfiniteStream": false,
      "UseMostCompatibleTranscodingProfile": false,
      "RequiresOpening": false,
      "RequiresClosing": false,
      "RequiresLooping": false,
      "SupportsProbing": true,
      "MediaStreams": [
        {
          "Codec": "mp3",
          "TimeBase": "1/14112000",
          "VideoRange": "Unknown",
          "VideoRangeType": "Unknown",
          "AudioSpatialFormat": "None",
          "LocalizedDefault": "Default",
          "LocalizedExternal": "External",
          "DisplayTitle": "MP3 - Stereo",
          "IsInterlaced": false,
          "IsAVC": false,
          "ChannelLayout": "stereo",
          "BitRate": 320000,
          "Channels": 2,
          "SampleRate": 44100,
          "IsDefault": false,
          "IsForced": false,
          "IsHearingImpaired": false,
          "Type": "Audio",
          "Index": 0,
          "IsExternal": false,
          "IsTextSubtitleStream": false,
          "SupportsExternalStream": false,
          "Level": 0
        },
        {
          "Codec": "mjpeg",
          "ColorSpace": "bt470bg",
          "Comment": "Cover (front)",
          "TimeBase": "1/90000",
          "VideoRange": "Unknown",
          "VideoRangeType": "Unknown",
          "AudioSpatialFormat": "None",
          "IsInterlaced": false,
          "IsAVC": false,
          "BitDepth": 8,
          "RefFrames": 1,
          "IsDefault": false,
          "IsForced": false,
          "IsHearingImpaired": false,
          "Height": 1000,
          "Width": 1000,
          "RealFrameRate": 90000,
          "ReferenceFrameRate": 90000,
          "Profile": "Progressive",
          "Type": "EmbeddedImage",
          "Index": 1,
          "IsExternal": false,
          "IsTextSubtitleStream": false,
          "SupportsExternalStream": false,
          "PixelFormat": "yuvj444p",
          "Level": -99,
          "IsAnamorphic": false
        }
      ],
      "MediaAttachments": [],
      "Formats": [],
      "Bitrate": 347052,
      "RequiredHttpHeaders": {},
      "TranscodingUrl": "/audio/d8ab1f90-c43b-1980-6610-1729a02d468d/stream.ogg?DeviceId=DE576418794013FD5CBD86989959222C&MediaSourceId=d8ab1f90c43b198066101729a02d468d&AudioCodec=opus&AudioBitrate=327680&AudioSampleRate=48000&PlaySessionId=2f82af29ca3d49c3b28af877b899bb96&api_key=REDACTED&TranscodingMaxAudioChannels=6&RequireAvc=false&EnableAudioVbrEncoding=true&Tag=36e349a6722278a1e0300b90b9f0048c&TranscodeReasons=ContainerBitrateExceedsLimit",
      "TranscodingSubProtocol": "http",
      "TranscodingContainer": "ogg",
      "HasSegments": false
    }
  ],
  "PlaySessionId": "2f82af29ca3d49c3b28af877b899bb96"
}

Do you mean the embedded album art? Good grief! Do you know if Jellyfin knows already on their GitHub?

Also what do you think of my work round? Is it possible? A UI and logic to find and convert only lossless file extensions like .flac? “Space Saver” menu or something in Synfonium?

I don’t know if Jellyfin knows, and no I won’t add workaround for server bugs.

Technically you request 320 max it’s more than 320 it transcode as expected.