Join 53,920 users and earn money for participation
read.cash is a platform where you could earn money (total earned by users so far: $ 236,426.74).
You could get tips for writing articles and comments, which are paid in Bitcoin Cash (BCH) cryptocurrency,
which can be spent on the Internet or converted to your local money.
Takes one minute, no documents required
Video Editing Trick: How to Replace the Audio Track of a Video
I run a pretty new fitness YouTube channel and periodically upload workout playlists with the best no copyright or free-to-use music on the internet. For that purpose I wanted to create a new playlist consisting of multiple audio files which I downloaded individually. I put the songs into my video editing software of choice -- which is the free VSDC video editor at the moment. (I'm not getting paid to say that. It's just the truth.)
I went ahead and created a nice music visualization and my laptop struggled through the rendering process. It took more than 4 hours of rendering time... My laptop is pretty slow... I never intended to do more than surfing the web and streaming videos with it, but well, things happened and now I'm trying to do video editing with it... 😅
After impatiently waiting more than 4 hours for the rendering to finish, I proudly opened the video file to admire my masterpiece.
Oh no, I forgot to adjust the tracks to matching volumes.
Some tracks were much louder than others. In a workout playlist, this can be intentional: You want the high energy exercises accompanied by loud, pushing music. And you want the cooldown songs to be quieter and relaxing. However, that was not what I had. I had various songs with more or less random volumes strung together. That usually happens when you take music from different sources -- which was what I had done.
Maybe it's just because I am a perfectionist (which is not necessarily a good thing -- this is not a humble brag 🙈), but I had to do something about it. Probably, nobody would have noticed (and maybe nobody will listen to the playlist anyway), but I had to fix it. I could not rest until the issue was solved. 🙈
I could change the volume on a couple of tracks and run the rendering process again. That would mean another 4 hours of 100% CPU usage... And the resulting video output would be exactly the same -- only the audio would be slightly different.
Or I could insert the rendered video as input to my video editor, mute its audio track and add the songs again -- this time with the correct volumes. That would work and it would be faster than rendering the video from scratch, but the process would still take about 3 hours of rendering time. And the video quality would probably suffer, because of the video re-rendering. I would get away with it, though, because the artifacts would not be very noticeable. However, repeat that process a couple of times and the video would not look good any more.
To save some time, I rendered a blank video (only a black rectangle as video output to be exact) together with the fixed sound. The rendering process was much faster. It took about 15 minutes. I checked that the sound of this video was as I wanted it to be. (I actually ended up readjusting the volumes and rendering the video 3 more times until I was happy with the sound.)
That was a good idea so far, but now I still needed a method to remove the sound track from the original video and replace it with the audio track of the new video. And I would like to keep the video as it is -- without re-rendering it. That would not only preserve the video quality, it would also be much faster.
After trying several methods and with some trial and error, I ended up with the command
This command uses ffmpeg to map the video stream of the first input file and the audio stream of the second input to the output video. An explanation can be found here.
The process took about 10 minutes and was mostly limited by the write speed of the microSD card that I used to save the output video file. -- Did I mention my laptop is slow? Yes, it also only sports 64 GB as an excuse for a SSD drive. And who knows how much of that space is taken up by Windows 10 and its updates -- so I had to use a microSD card to store the video with the humble size of almost 7 GB...
To be honest, none whatsoever... Because the research, trial and error to get to the above method took me more time than it would have taken my laptop to do the 4 hours of rendering. However, if I mess up again, now I know how to fix the problem in a less time-consuming way.
That's also one of the reasons why I am writing this article. I can not only help others searching for a solution to this problem -- now I have a place to look up the solution myself in case I ever need it again. 😄
When I create a new workout Playlist, I will first add all the songs in the video editor, then render a blank video and check the audio until I am satisfied with it.
Then and only then, I will start to work on the music visualization. Using this improved workflow the time-consuming video rendering has to be done only ONCE -- hopefully. If not, I keep a link to this post nearby...
If you are using a (micro-)SD card to expand your laptop's memory like I did, make sure NOT to use the FAT32 file system. Otherwise, you will waste time rendering a video and once it exceeds a file size of about 4 GB, the file is corrupted and you can restart the rendering process... (Use exFAT instead of FAT32 and the problem is solved.)