Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Mar 2021
Posts: 100
|
best options for mono encoding ffmpeg libpous.
Hi i I am Rupesh from India and I brought a new pc with AMD Ryzen zen3 5500GT APU and Asus prime b450 motherboard and installed Linux Fedora 40 and I have some aac m4a music files and I want to convert them to opus files.
I installed libopus and libfdk-aac and compiled ffmpeg with options successfully using the following command --enable_libopus and --enable_libfdk-aac I want to convert aac m4a music files to opus using ffmpeg and libopus and so I have created a small bash script as follows. Code:
#/bin/bash
for i in *.mp4;
do name="${i%????}";
echo $name;
ffmpeg -y -i "$i" -f mp4 -vn -ac 1 -c:a libopus -vbr on -application audio -mapping_family 0 -b:a 20k -af aresample=resampler=soxr -ar 48000 "${name}.opus";
done
So for encoding from stereo to mono I have chosen option which is implied to libopus as Code:
-ac 1 mapping_family 0 I have even choosen the following options which are related to vbr mode and the output audio is music not speech. Code:
-vbr on -application audio If you think some other options need to be added to the above script suggest them also. Regards, Rupesh. |
|
|
|
|
|
#2 | Link |
|
ffx264/ffhevc author
![]() Join Date: May 2007
Location: /dev/video0
Posts: 2,035
|
Why are you encoding lossy audio files to another lossy audio codec? That's not recommended!
__________________
The Cyberpunk Database || NTP & NTS Time Server || Mirror Services ffhevc || ffx264 || ffxvid |
|
|
|
|
|
#4 | Link |
|
Donor
![]() Join Date: Jun 2024
Location: South Africa
Posts: 679
|
You can remove vbr on, application audio, and mapping_family because they're already set to those defaults. For the resampler, use:
Code:
-af resample=48000:resampler=soxr I believe xHE-AAC beats Opus in the lower-bitrate domain, but is more difficult to encode and decode, from a compatability point of view. Last edited by GeoffreyA; 2nd September 2024 at 19:40. |
|
|
|
|
|
#5 | Link |
|
Donor
![]() Join Date: Jun 2024
Location: South Africa
Posts: 679
|
I did some quick testing this morning. Firstly, one doesn't need to set 48 kHz because it is converted to that implicitly. (Add "-loglevel debug" for more insight into what the filtergraph is doing behind the scenes.) So, a shorter, cleaner command might be:
Code:
ffmpeg -i INPUT -ac 1 -af aresample=resampler=soxr -c:a libopus -b:a 20k OUTPUT |
|
|
|
|
|
#9 | Link |
|
Donor
![]() Join Date: Jun 2024
Location: South Africa
Posts: 679
|
Being on Windows, I'm not sure how to compile FFmpeg with Exhale support, Exhale being the USAC/xHE-AAC encoder. Perhaps try to find an Exhale build for Linux. Note that compatibility is still a problem. At any rate, audio below 64 kbps will not be that good.
https://gitlab.com/ecodis/exhale If you get hold of an Exhale build, you could pipe the audio from FFmpeg. Last edited by GeoffreyA; 3rd September 2024 at 16:16. |
|
|
|
|
|
#10 | Link |
|
Registered User
Join Date: Mar 2021
Posts: 100
|
I think that xheaac is not fully implemented I mean development and testing work is going on and it takes few years to get full support.
I have searched Google for xheaac but unfortunately I found few results which are considerable. If you search for other encoders for example lame, aac you can get thousands of webpages related to documentation, operating systems support etc.,. |
|
|
|
|
|
#13 | Link |
|
Donor
![]() Join Date: Jun 2024
Location: South Africa
Posts: 679
|
https://www.ffmpeg.org/ffmpeg-codecs.html#libopus-1
According to the documentation, mapping_family controls how the codec works with mono, stereo, or surround-sound input. A value of 0 is for mono and stereo input; 1 for surround, or more than two channels; and 255 for independent streams with an unspecified layout. By default, mapping_family has a value of -1, which, if the input is mono or stereo, picks the right setting of 0 automatically. But if your audio has more than two channels, set it to 1, which will turn on surround-sound masking and LFE optimisations. |
|
|
|
![]() |
| Tags |
| ffmpeg, libopus, mono, options |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|