Encoding raw audio file to opus using ffmpeg vs opusenc 2020-12-03 19:59:08 I have several hundred Flac audio files, and having done some research recently I find that the most efficient lossy codec is Opus. So I tried several different encoders (I'm on Ubuntu) and chose 2: ffmpeg (-c:a libopus) and opusenc.I created test files to see if there were any significant differences between these two:- ffmpeg always drops the album photo (unlike opusenc).- opusenc creates a file about 800 bytes larger than ffmpeg (negligible).The rest of the differences only occur at the level of the output file metadata (acquired with the MediaInfo software and given by opusenc in command-li) :- the "Comment" tag is renamed "Description" only with ffmpeg (negligible, but how to explain that ?)- only opusenc adds the tag "ENCODER_OPTIONS".- "Writing application": opusenc from opus-tools 0.1.10 vs Lavc58.54.100 libopus- "Writing library": libopus 1.3.1 vs Lavf58.29.100- "Sampling rate" : same as the original one for opusenc (even 44.1 kHz), but still 48 kHz for ffmpeg (without specifying anything in the encoding parameters).The things I find the most shocking are the abandonment of the album photo by ffmpeg (I don't mind because I wanted to remove it anyway) and the sampling.Let's take a closer look at the sampling:ffmpeg supports ONLY 48 kHz (I get an error if I try with "-ar 44100" or "-ar 96000"). Personally, I would like either 44.1 or 48 kHz (no need for more because the human ear would not be able to hear it and "files at [96 and 192 kHz] are internally converted to 48 kHz", so I find the 48 kHz of ffmpeg totally coherent and understandable.Here we come to a bigger problem: on the same site, we are told "[For now], the best way to encode audio into Opus files is to use the opusenc command-line tool". "Unfortunately", by encoding a 96 kHz source file, the output file has the same sampling, which is inconsistent with the internal conversion at 48 kHz . Unless maybe it is really done and opusenc add "empty data" to the output file...First observation: a 96 kHz input file gives one of 48 kHz with ffmpeg and one of 96 kHz with opusenc. The latter is about 800 bytes heavier than the ffmpeg one, how is this possible ? So we see that there is no "empty data", maybe opusenc defines the sampling ceiling without adding anything ?So I try to modify this sampling with "--raw-rate 48000" (always with a 96 kHz input file). The new file is now at 48 kHz, but weighs 3.2 Mbytes instead of 2.4 Mbytes without this parameter ... And more important: the sound is completely corrupted! (A continuous sound like a fog). So this solution is not possible. Is there a way to change the sampling rate correctly to 48 kHz ?My most important question, why the output file with opusenc is set to 96 kHz while the input file is converted internally at 48 kHz ? Is it still better to use opusenc compared to ffmpeg ? My other questions are all underlined.A huge thank you in advance to all of you !