Script Writer wanted, please.....
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Script Writer wanted, please.....
Script Writer wanted, please.....
15-09-2020 1:40 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
In my thread.....
Ideally, I would like to be able to "normalise/equalise" the volume level , based on the average, of lowest to highest .....
and to process a complete folder at a time... probably have to list them all ( copy and paste to the script )..
this would mean a "random" number of files depending on the content level of each folder (artiste ) .
Alternative to that last bit.. would be to (say) process 20 at a time.
Processed files to be saved in a secondary folder... with the same name as the original...e.g. Thalia ( the orginal folder) saved to.... Thalia2 ( processed ) .
Re: Script Writer wanted, please.....
19-09-2020 7:29 PM - edited 19-09-2020 7:31 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
According to https://en.wikipedia.org/wiki/Loudness_war , where the dynamic range is deliberately reduced even to the extent of chopping transient peaks, you are in danger of of making things even worse [from the sound quality point of view].
It is likely that you would only be able to boost/cut a single track at a time.
As an alternative, you might find [some of] https://trac.ffmpeg.org/wiki/AudioVolume to be useful.
It suggests that a non-optimal solution is:-
ffmpeg -i input.wav -filter:a loudnorm output.wav
The input/output files need not be wav files - video or pretty much anything will do.
Warning! You will probably lose some metadata.
This is a CLI program.
"In The Beginning Was The Word, And The Word Was Aardvark."
Re: Script Writer wanted, please.....
19-09-2020 10:16 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@VileReynard There is a program, called MP3Gain... which.. when you run it... you can put in any number of music files/tracks ( audio only ) .. click the "go" or "start" button, and it will analyse all the files/music tracks listed, and show which one`s are high volume and which ones are low volume levels...
Not sure if you can set a "mean" setting between the two or not... its a long time since I used it to make audio cd`s for the car... however... after some while, it would produce all the tracks at an ambient level, ready to re-save and process on to the Audio CDrom as an album. and it does not seriously affect the sound quality
MP4Gain does the same kind of thing... with video sound.. but it costs about $50 USD. Whereas MP3Gain was free, when I used it... not sure if it is still free....
Re: Script Writer wanted, please.....
20-09-2020 9:06 AM - edited 20-09-2020 9:09 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Some car players will 'normalise' audio during playback but presumably yours doesn't have that option?
Googling I found this program which has a free version for non-commercial use which looks as if it might be suitable (no Linux version but you may be able to run the Windows version with some of your sorcery).
Normalisation is one of it's features and also batch conversion.
I haven't tried it.
https://www.nch.com.au/switch/index.html
Edit: typos
Re: Script Writer wanted, please.....
20-09-2020 9:44 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Hi @RobPN .... hmm... that is an AUDIO program....( MP3 type files) I want to "level out".. for want of a better word, the volume levels, on music VIDEO`s.... (MP4 type files).... so that when I run a playlist of Music Video`s.. they are all "about" the same volume level,...and I don`t get my eardrums blown away or strain them to hear, depending on the variable volume levels..
Thanks for having a look for us, though...
Re: Script Writer wanted, please.....
20-09-2020 9:57 AM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Fair enough @shutter , when I caught up with the thread I started at the latest post (#3), and still being half-asleep forgot about the video requirement.
Re: Script Writer wanted, please.....
20-09-2020 6:04 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
OK:- here is a [kind of] worked example of a mobile phone video [not one taken by me]:-
The important stuff is in bold. A lot of strictly ignorable output occurs...
jeremy@hector:~$ ffmpeg -i '/home/jeremy/Pavement5-6sep19.mp4' -filter:a volumedetect -f null /dev/null
[....]
[Parsed_volumedetect_0 @ 0x563b67818ac0] n_samples: 1632256
[Parsed_volumedetect_0 @ 0x563b67818ac0] mean_volume: -23.5 dB
[Parsed_volumedetect_0 @ 0x563b67818ac0] max_volume: -1.6 dB
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_1db: 3
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_2db: 20
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_3db: 55
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_4db: 109
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_5db: 323
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_6db: 605
[Parsed_volumedetect_0 @ 0x563b67818ac0] histogram_7db: 902
Suppose you want to boost the volume by 1.6dB so that you don't ruin the sound [this is something to play with], you would then run one of:-
ffmpeg -i '/home/jeremy/Pavement5-6sep19.mp4' -filter:a "volume=+1.6dB" output.mp4
Because this remuxes both video and sound this is not ideal - so try
ffmpeg -i '/home/jeremy/Pavement5-6sep19.mp4' -filter:a "volume=+1.6dB" -c:v copy -c:a aac output.mp4
This will copy the video and only remux the sound - in my example it defaulted to 50kb/sec - but you can specify a decent value e.g. for 160kb/sec:-
ffmpeg -i '/home/jeremy/Pavement5-6sep19.mp4' -filter:a "volume=+1.6dB" -c:v copy -c:a aac -b:a 160k output.mp4
This will copy the video, remux the sound at 160kb/sec
It is quite feasible [easy] to script this, when you have discovered the loudness you want to aim for.
Samples below...
"In The Beginning Was The Word, And The Word Was Aardvark."
Re: Script Writer wanted, please.....
20-09-2020 6:43 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@VileReynard OK... well, I can probably mess up my laptop with that... so I `ll dig out an old Mint HDD and play with it...
Presumably I have to listen to each video sound level to decide the final level to set on the script ?
I am assuming that this only does one video at a time... so is there any way, I could run (say) 20 video`s through the same script? or would that be a difficult ask, in light of my previous question about final levels?
Re: Script Writer wanted, please.....
20-09-2020 7:03 PM - edited 20-09-2020 7:04 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
It's not necessary to listen to every one, if you've got hundreds of files...
Well I don't understand the meaning of the figures about max_level. You would have to find by trial and error what a good target to aim for would be, by trying several widely differing videos.
Importantly, you need to check that your equipment can handle the mangled output of ffmpeg [it should do].
A script could easily pick out the existing level from the ffmpeg rubbish and apply whatever rule you deem necessary, so that if you want to make all your videos to have, say a level of +3dB or whatever then the script could compute the necessary amendment.
It would be especially convenient [for the script] if you wanted to modify every MP4 file in a directory.
Obviously, keep backups!!!
"In The Beginning Was The Word, And The Word Was Aardvark."
Re: Script Writer wanted, please.....
20-09-2020 8:07 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
It's not necessary to listen to every one, if you've got hundreds of files...
reckon I got about 300 music vids....
Well I don't understand the meaning of the figures about max_level. You would have to find by trial and error what a good target to aim for would be, by trying several widely differing videos.
Likewise ! ... my ears go on different measurements.... too loud.. loud.... medium loud... too soft.. and hardly hearable... how that relates to dB measurements I haven`t a clue ! ..
Importantly, you need to check that your equipment can handle the mangled output of ffmpeg [it should do].
Yep... I reckon it could... Most of the vids are "acceptable" as they are... .. so it may well be... making a list when I make up a playlist, and make notes of the "less loud" ones, to process at a later date..
A script could easily pick out the existing level from the ffmpeg rubbish and apply whatever rule you deem necessary, so that if you want to make all your videos to have, say a level of +3dB or whatever then the script could compute the necessary amendment.
would the +3dB level be applied to the existing level of the music volume... or would that be an arbitrary point that all files will be reset to +3dB ( or whatever is deemed the acceptable loudness level)
It would be especially convenient [for the script] if you wanted to modify every MP4 file in a directory.
Yep... that would, indeed, be especially conveneint too !...
Obviously, keep backups!!!
Always.... but sometimes its fun to live dangerously ! ( fall back on re -downloading from You tube !)
Re: Script Writer wanted, please.....
20-09-2020 9:38 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
If it was me... 😀
I'd find several videos of widely differing loudness's and run the ffmpeg measure phase against each one.
Compare bits of the quiet ones against bits of ones with good sound quality, because some might be too loud and have horrible things done to the sound quality.
This ought to lead to some kind of optimal target to aim for, by processing each file.
The script could do the calculations for you since it can measure each files current loudness value and you would provide some target value.
BTW I tried this on Citizen Kane - 2GB [from the BBC] and it took about 10 minutes to decide that:-
max_volume: -4.4 dB 🙄
"In The Beginning Was The Word, And The Word Was Aardvark."
Re: Script Writer wanted, please.....
20-09-2020 11:04 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
@VileReynard OK>.. thanks for that explanation... I`ll give it a go, sometime tomorrow, maybe, meanwhile. I am posting another "trivial" problem , perhaps you may have some solution to that one !
Re: Script Writer wanted, please.....
21-09-2020 2:31 PM - edited 21-09-2020 2:35 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
OK.. SO ... I found a video, to run a test on, and this is how it went.....
I first got the "properties" and copied the location.....
Then I started a Terminal screen... and "modified" your line below....
ffmpeg -i ' *************************************************' -filter:a "volume=+1.6dB" -c:v copy -c:a aac -b:a 160k output.mp4
Using the above "location" as a "copy and paste" so that I would not make a typo in the location.
here are two pics... ( cos the screen could not accommodate it all in one run ! )
of the terminal result....
all of which means absolutely nothing to me.... .... wot am I doing wrong ? ? ? ?
am I supposed to run this on the terminal by itself... or within another app/program ?
Re: Script Writer wanted, please.....
21-09-2020 3:54 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
You didn't give it the correct filename. You just gave the location(directory) but didn't put the name of the file on the end.
Superusers are not staff, but they do have a direct line of communication into the business in order to raise issues, concerns and feedback from the community.
Re: Script Writer wanted, please.....
21-09-2020 6:30 PM
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Report to Moderator
Ah... ! OK>. will give that a go...
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Plusnet Community
- :
- Forum
- :
- Other forums
- :
- Tech Help - Software/Hardware etc
- :
- Script Writer wanted, please.....