Steps for recording noise-free AUDIO or removing noise from a recorded AUDIO file:
When you record an audio it is usually very unclear and full of background in Ubuntu. Following steps will help you remove the noise from audio to a great extent:
You can play the cleaned audio from terminal itself using the command :
When you record an audio it is usually very unclear and full of background in Ubuntu. Following steps will help you remove the noise from audio to a great extent:
- First of all you will need to install SOX package. To install "sox" open the terminal and run the following command:
sudo apt-get install sox
- Record the audio in a file original.wav :
rec -c 1 -r 16000 -b 16 original.wav
- This command records audio until ctrl+C is pressed.
- -c defines that sound is recorded in a single channel, -r defines 16000 sample-rate and -b defines 16-bit sample encoding.
- Amplify the audio if it is not audible.
sox -v 256.0 original.wav amplified.wav
- This command amplifies 256 times (amplification works on logarithmic scale)
- Amplified audio is saved in other file with name amplified.wav
- Trim out a noise sample from it :
sox amplified.wav noise.wav trim 0 0.5
- This command will trim out noise of length 0.5 seconds starting from 0 seconds and save it to the file noise.wav
- Create the noise profile :
sox noise.wav -n noiseprof noise.prof
- Create cleaned audio after removing noise :
sox amplified.wav cleaned.wav noisered noise.prof 0.2
- You can set the noise removing parameter to any value. Usually 0.2 to 0.3 gives better results.
You can play the cleaned audio from terminal itself using the command :
play cleaned.wav
Steps for recording noise-free VIDEO or removing noise from a recorded VIDEO file:
Following steps refer to the steps for recording noise-free video:
Following steps refer to the steps for recording noise-free video:
- First of all you will need to install FFMPEG package. To install "ffmpeg" open the terminal and run the following commands:
sudo add-apt-repository ppa:kirillshkrogalev/ffmpeg-next
sudo apt-get update
sudo apt-get install ffmpeg
- You can record onscreen video using Simple Screen Recorder. To install "simple screen recorder" run the following commands:
sudo add-apt-repository ppa:maarten-baert/simplescreenrecorder
sudo apt-get update
sudo apt-get install simplescreenrecorder
- Split the audio and video streams :
ffmpeg -i original.mp4 -qscale 0 -an tmpvid.mp4
ffmpeg -i original.mp4 -qscale 0 tmpaud.wav- First command stores the video stream to the file tmpvid.mp4
- Second command stores the audio stream to the file tmpaud.wav
- Now remove noise from the audio file tmpaud.wav following above steps.
- Merge back the audio and video and audio :
ffmpeg -i cleaned.wav -i tmpvid.mp4 -qscale 0 -strict -2 cleanedvid.mp4
- This command will merge the audio from cleaned.wav and video from tmpvid.mp4 to the file cleanedvid.mp4
No comments:
Post a Comment