Sample Header Ad - 728x90

sox command is automatically adding delay in the begining of mp3

0 votes
2 answers
1679 views
I have a few video files which have "humm" sound in the audio. So, I created the following script for batch processing. **I am using ffmpeg, to extract audio to .mp3, and sox to denoise,** which will output noise free mp3 file. enter image description here
mkdir -p ./tmp;
for f in *.mp4;
do
    title=${f%.mp4};
    echo "Working on $f";
    mv ./"$f" ./tmp/ && ffmpeg -i ./tmp/"$f" -f mp3 -ab 128000 -vn ./tmp/"$title"_noise.mp3;

    echo "Sox process started...";
    sox -v 0.80 ./tmp/"$title"_noise.mp3 ./tmp/"$title"_128.mp3 noisered ./noise_profile 0.20 && sox ./tmp/"$title"_128.$mp3 -C 96 ./$title.mp3;

    echo "Removing Audio from video file...";
    ffmpeg -loglevel warning -stats -y -i ./tmp/"$f" -c copy -an ./"$f";
done
But the problem is, I observed that there is 00:00:00.050s (HH:MM:SS.ms - Checked with Audacity) of delay added to the final mp3 file. I believe **Sox** is adding this delay. 1. **How can I solve this? Or, how can I remove/trim 00.050 seconds from the beginning and add 00.050 seconds of silence at the end of the audio track?** OR 2. **Is there any other better way to finish my task?** NOTE: I am trying to work with .wav instead of .mp3 after reading below reply, if it works I will update here.)
Asked by user3025253 (23 rep)
Jul 6, 2020, 02:08 PM
Last activity: Jul 7, 2020, 02:19 PM