[FFmpeg-user] mpeg2 filesize reduction: reduce video, enhance audio, codec selection
steveboyer85 at gmail.com
Wed May 7 19:10:22 CEST 2014
> As I had mentioned, I did a run on the previously tested 3.1G video file
>> $ ffmpeg -i video1.mpg -c:a libfdk_aac -af 'volume=1.8,
> compand=.3|.3:1|1:-90/-60|-60/-40|-40/-30|-20/-20:6:0:-90:0.2' -c:v libx264
> -preset slow -crf 32 -f mp4 video1-out.mp4
> * File size and video quality consistent with previously reported result.
Just pointing out: video quality should actually be identical as the
settings, algorithms, software, etc are identical.
> * compand made a very nice job of pulling the outlying sound values to a
> more standard volume range.
> * The problem is, when the speaker starts to speak, there is a background
> noise like a microphone being pulled over wool - a "crishhhhh" sound. It's
> borderline; the speech can be understood but it's a major strain on the
> ears. If that particular frequency were louder, speech would become
Boo! It sounds like you have background noise now to contend with.
This is beyond my knowledge of FFMPEG, but is easily within my
knowledge of Audacity. At this point, my reccomendation would be to
break out the audio and edit in audacity:
ffmpeg -i video1.mpg audio1.wav
>From there, highlight a section that is only background noise with no
one talking that you can hear the "crishhhhh," go to Effect -> Noise
Removal -> Get Profile. Then, select the entire audio stream, Effect
-> Noise Removal -> OK (or preview -- which ever) and listen to it. I
use the default values typically. The filter works by taking a
sampling of the noise (getting noise profile), then isolating/removing
it from the rest of the stream. This DOES cause some audio distortion
in the voice, but it might be subtle enough for you.
THEN, you need to use the compressor (Effect -> Compressor). From
here, you can tweak the dynamic range, making quieter sections louder,
and louder sections quieter. This again, might be acceptable for you.
If not, you can try to use a filter for low/high frequencies that you
found work well for the vocal range (and now we're outside of my
Audacity expertise) and boost them / reduce the opposite, and finally
amplify the entire thing to a better level (Effect -> Amplify).
>From there, export as a WAV file (lossless audio), then...
ffmpeg -i video1.mpg -i audio1.processed.wav -map 0:0 -map 1:0 -c:a
libfdk_aac -b:a 128k -c:v libx264 -preset slow -crf 32 video1-out.mp4
and THAT should then encode the entire video with the x264 codec,
settings, etc and encode the processed audio file into AAC format @
128 kb/s (typically, transparent compression for stereo audio
sources). The "map" commands are saying "from stream #1 (video1.mpg),
use stream #1 (typically, video) and from stream #2
(audio1.processed.wav), use stream #1 (only one stream - audio)."
Alternatively, you can modify the mapping to pull video from an
already compressed video1-out.mp4 just use:
ffmpeg -i video1-out.mp4 -i audio1.processed.wav -map 0:0 -map 1:0
-c:a libfdk_aac -b:a 128k -c:v copy video1-out-final.mp4
This will go VERY fast, as it is not converting video, just the audio.
More information about the ffmpeg-user