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

 

Go Back   Doom9's Forum > Video Encoding > VP9 and AV1

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd February 2025, 15:35   #1  |  Link
rupeshforu3
Registered User
 
rupeshforu3's Avatar
 
Join Date: Mar 2021
Posts: 100
optimal settings or options to obtain high quality video output ffmpeg libaom.

Hi I am Rupesh from India and I brought a new desktop pc with ryzen 5500GT cpu and Asus prime b450 motherboard. I have installed Linux Operating System along with ffmpeg, opusenc, fdkaac, libaom, soxr successfully. I have thousands of YouTube videos whose space occupied upto 1tb or 1024 gb. I want to compress these videos using libaom and opus codec, fdk m4a codec.

My desktop PC consists of cpu with 12 ryzen Zen 3 cores with integrated GCN3 graphics and 16 GB ram which is sufficient to work with libaom and ffmpeg.

I want to compress these videos expecting the total output size 250 GB to 350 GB.

I am expecting that the encoder must take maximum time but must produce high quality output file and the output file size must be as low as possible.

For my needs I have selected ffmpeg with libaom and two pass encoding. I think that aomenc with two pass encoding takes much time but produce high quality video file.

I tried to use aomenc by passing the output of ffmpeg in yuv format but I got errors and so I have selected ffmpeg with libaom.

Previously I have compressed these videos using ffmpeg and libaom and the output quality of the compressed video is acceptable for me but I have some doubts related to options or settings to be specified in the encoder.


The command previously I used to compress these videos are as follows

Code:
ffmpeg -i "$i"  -c:v libaom-av1 -b:v 150k -cpu-used 3 -row-mt 1 -g 240 -tile-columns 2 -tile-rows 1 -arnr-strength 3 -pass 1 -f null /dev/null && \
   ffmpeg -i "$i"  -c:v libaom-av1 -b:v 150k  -cpu-used 3 -row-mt 1 -g 240 -tile-columns 2 -tile-rows 1 -arnr-strength 3 -pass 2 -f mp4 -c:a libfdk_aac -b:a 52k -ar 44100  "${name}_compressed_fdk_new.mp4";
In ffmpeg documentation they have specified that the default value of --arnr-strength is -1 but in opusenc command line parameters documentation they have specified that recommended value for --arnr-strength is 3.


In ffmpeg documentation they have specified that the default value of --cpu-used is 1 but in opusenc command line parameters documentation they have specified that recommended value for cpu-used is 3.

Somewhere I read that not to use --tile-columns, --tile-rows if the source video file bitrate is less than 4k.

In ffmpeg documentation they have specified that row-mt will be disabled by default and if we want we can enable it.

I used another way to compress source video file by separating video and audio streams and compress them separately and finally join the resulted files. I done it as follows.

Code:
name="${i%????}";
  echo $name;

cp "${name}.mp4"  original.mp4;

  ffmpeg -i original.mp4  -an -c:v copy originalvidout.mp4 -vn -c:a copy originalaudioout.m4a;
  
   ffmpeg -i originalaudioout.m4a -vn -af aresample=44100:resampler=soxr -ac 1 originalaudiooutmono.wav;
   
   opusenc --bitrate 20 --vbr originalaudiooutmono.wav convertedaudioopus.opus;
   
   ffmpeg -i originalaudioout.m4a -vn -af aresample=44100:resampler=soxr originalaudiooutstereo.wav
   
   fdkaac -b 48k -p 5 originalaudiooutstereo.wav -o convertedaudiofdk.m4a;

ffmpeg -i originalvidout.mp4 -an -c:v libaom-av1 -b:v 150k -cpu-used 3 -row-mt 1 -g 240 -tile-columns 2 -tile-rows 1 -arnr-strength 3 -pass 1 -f null /dev/null && \
   ffmpeg -i originalvidout.mp4 -an -c:v libaom-av1 -b:v 150k  -cpu-used 3 -row-mt 1 -g 240 -tile-columns 2 -tile-rows 1 -arnr-strength 3 -pass 2 -f mp4 ffmpegaomaomvideoout.mp4;

ffmpeg -y -i ffmpegaomaomvideoout.mp4 -i convertedaudioopus.opus -c:v copy -c:a copy  "${name}_compressed_opus_new.mp4"

ffmpeg -y -i ffmpegaomaomvideoout.mp4 -i convertedaudiofdk.m4a -c:v copy -c:a copy  "${name}_compressed_fdk_new.mp4"
I selected second way because original opusenc and fdkaac provides high quality audio output compared to ffmpeg and libopus, libfdkaac.

opusenc and fdkaac can't work directly with m4a files or MP3 files and they can understand only wav files so I have converted m4a files to temporary wav files.

Now my questions or doubts are as follows

1) What is the meaning of --arnr-strength and which is preferred value for it ie., -1 or 3.

2) In the second way I have used soxr as resampler because I think it provides high quality audio. Is it true.

3) According to you is there any benefit of using opusenc and fdkaac directly instead of ffmpeg, libopus, libfdkaac.

4) As one person suggested not to use --tile-columns --tile-rows for videos with bitrate below 4k. I think that using those options the output quality will be high so if I use are there any negative affects.

5) In order to reduce the output file size I have selected libaom video bitrate to be between 30k to 150k. Can I continue.

I am providing the complete script which I have created in the attachment and if you want you can use it directly or modify and use it. If possible please try to examine the script.


Kindly try to clarify my doubts.

Regards,
Rupesh.
Attachments Pending Approval
File Type: txt ffmpeg_aom_fdk_opus_2pass.sh.txt
rupeshforu3 is offline   Reply With Quote
Reply

Tags
ffmpeg, high quality, libaom, low file size

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:41.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.