2025-01-19, 08:25 PM
(This post was last modified: 2025-01-19, 08:31 PM by felix920506. Edited 2 times in total.)
This is a short guide on how to get Opus audio to direct play on Apple devices (without using something like mpv or vlc)
Especially useful for Finamp.
Requirements: iOS 17.4 or above on the client (I don't know the exact lower limit but I know 17.4 works)
Limitations: Mono or Stereo only, You need to manually re-add embedded images.
How:
If you wish to convert pre-existing music files in other formats to opus, run the following command:
If you wish to make your pre-existing opus music direct playable, run the following command:
Place the resulting file onto Jellyfin and rescan the library.
Breakdown of the commands above:
-i <file> = specify input file
-vn = discard any video streams
-c:a <value> = specify audio codec.
-b:a <value> = specify audio output bitrate. No effect when codec is copy.
-ar 48000 = specify audio sample rate. No effect when codec is copy
-f mp4 = Specify that the output file should be written in mp4 format.
"output.m4a" = specify the output file
Replace
Change the value after
IMPORTANT:
1.
2. You SHOULD NOT use another lossy codec (mp3, aac etc.) as the source file when converting. It WILL lead to worse audio quality than the source regardless of the settings you use.
3. the sample rate can only be set to 8000, 12000, 16000, 24000 or 48000. Other values are not supported by libopus. For most cases, 48000 is recommended
Metadata:
Most of the important metadata will be retained during the conversion. However, the images are a notable exception. You will need to re-add them with another tool after the conversion.
Comparison of the metadata retained before and after the conversion. Left: before, Right: after
Especially useful for Finamp.
Requirements: iOS 17.4 or above on the client (I don't know the exact lower limit but I know 17.4 works)
Limitations: Mono or Stereo only, You need to manually re-add embedded images.
How:
If you wish to convert pre-existing music files in other formats to opus, run the following command:
Code:
ffmpeg -i "input.flac" -vn -c:a libopus -b:a 256k -ar 48000 -f mp4 "output.m4a"
If you wish to make your pre-existing opus music direct playable, run the following command:
Code:
ffmpeg -i "input.opus" -vn -c:a copy -f mp4 "output.m4a"
Place the resulting file onto Jellyfin and rescan the library.
Breakdown of the commands above:
-i <file> = specify input file
-vn = discard any video streams
-c:a <value> = specify audio codec.
-b:a <value> = specify audio output bitrate. No effect when codec is copy.
-ar 48000 = specify audio sample rate. No effect when codec is copy
-f mp4 = Specify that the output file should be written in mp4 format.
"output.m4a" = specify the output file
Replace
input.flac
with your input file and output.m4a
with your desired output file name.Change the value after
-b:a
to get a desired balance between quality and file size. Bigger value will mean larger file size but better audio quality. Youtube videos use 128k at the highest quality level for reference.IMPORTANT:
1.
-f mp4
option MUST NOT be omitted, otherwise conversion WILL FAIL.2. You SHOULD NOT use another lossy codec (mp3, aac etc.) as the source file when converting. It WILL lead to worse audio quality than the source regardless of the settings you use.
3. the sample rate can only be set to 8000, 12000, 16000, 24000 or 48000. Other values are not supported by libopus. For most cases, 48000 is recommended
Metadata:
Most of the important metadata will be retained during the conversion. However, the images are a notable exception. You will need to re-add them with another tool after the conversion.
Comparison of the metadata retained before and after the conversion. Left: before, Right: after