Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER for Video Editing/Mangling

Reply
 
Thread Tools Display Modes
Old 08-21-2019, 10:36 AM   #1
mehmethan
Human being with feelings
 
mehmethan's Avatar
 
Join Date: Jun 2011
Posts: 603
Default How can I replace audio of a video file in Reaper?

Hi I want to replace audio of a video file in Reaper.I don't want to effect video quality, format or properties at rendering process. So no changes on video but only change will be the audio.

Video file is .MOV format size 514 MB and properties are like this.
Length: 5:22.920
Video: 1920x1080@25.00fps, Aspect=1.00, Decoding format=I420/YV12
Audio: 48000Hz 2ch 32bps
Video: 1920x1080, h264, 25.00fps
Audio: 48000hz, 32bps, 2ch, mp4a
Video data rate : 12859kb/s
Video bit rate : 12989 kb/s
Audio bit rate : 130 kb/s

How should I render this video with new audio file so the final render will be exactly the same with the original except audio ?

Last edited by mehmethan; 08-21-2019 at 11:02 AM.
mehmethan is offline   Reply With Quote
Old 08-22-2019, 03:39 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

I don't think you can avoid re-encoding the video completely when rendering the video from Reaper. You will likely need to do something like render the new audio as an audio file and replace the audio in the video file with some external program.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-22-2019, 07:28 AM   #3
mehmethan
Human being with feelings
 
mehmethan's Avatar
 
Join Date: Jun 2011
Posts: 603
Default

Quote:
Originally Posted by Xenakios View Post
I don't think you can avoid re-encoding the video completely when rendering the video from Reaper. You will likely need to do something like render the new audio as an audio file and replace the audio in the video file with some external program.
Thank you for the the answer.
mehmethan is offline   Reply With Quote
Old 08-29-2019, 10:20 PM   #4
superblonde.org
Human being with feelings
 
Join Date: Jul 2019
Posts: 1,035
Default

use ffmpeg directly on command line, you can split the streams and rejoin with new streams 'losslessly' (i.e. no decode, reencode)
superblonde.org is offline   Reply With Quote
Old 09-13-2019, 06:00 PM   #5
SonicAxiom
Human being with feelings
 
SonicAxiom's Avatar
 
Join Date: Dec 2012
Location: Germany
Posts: 3,005
Default

AVIDemux can replace the audio stream in a video file without re-encoding (only re-muxing). You can also add another audio stream to a video while keeping the original audio stream. The resulting video will have 2 (selectable) audio streams (like a DVD that offers to choose from multiple languages). I'm using this feature after remastering a video's original audio so that the client can toggle between the original and my remastered version for convenient A/B comparison. He only needs a video player that can toggle between audio streams, preferably via a single keystroke like PotPlayer.

.
__________________
Check out AVConvert (free, super-fast media file manipulation via the right-click context-menu in Windows Explorer) and my free VST plugins.
My Reaper tutorials and studio related videos on youtube.
SonicAxiom is offline   Reply With Quote
Old 09-15-2019, 11:26 AM   #6
sveinpetter
Human being with feelings
 
Join Date: Dec 2011
Location: Norway
Posts: 100
Default Encode Videos with FFmpeg

This is a good one for: Encode Videos with FFmpeg
https://digitalfortress.tech/tricks/...s-with-ffmpeg/


I have copy / paste this:

6. Add/Remove Audio from a Video

While adding audio, there are 2 possibilities depending on the expected end result.

A. Replace the original Audio
You can overwrite the original audio with a new audio as shown below. By default, the duration of the output will be that of the longer input. That means that if the audio is longer than the video, the video will freeze when it reaches its end whereas the audio will continue until it reaches the end of its duration, and vice-versa.

To avoid that, you could use either use the -shortest option which truncates the output to the same duration as the shortest input or use the -t 300 option which will truncate the output at the 300th second.

1 ffmpeg -i inputAudio.mp3 -i inputVideo.avi outputVideo.avi
2 ffmpeg -i inputAudio.mp3 -i inputVideo.avi -shortest outputVideo.avi
3 ffmpeg -i inputAudio.mp3 -i inputVideo.avi -t 300 outputVideo.avi
4 /**
5 * -i => Input file
6 * -shortest => Makes output to be the same duration as the shortest input
7 * -t => time in seconds
8 */

B. Add an additional Audio track

If you wish to conserve the original audio, and only add a new audio track, it can be done by mapping the audio streams.

1 ffmpeg -i input_video_with_audio.avi -i new_audio.ac3 -map 0 -map 1 -c copy outputVideo.avi
2 /**
3 * -i => Input file
4 * -c => Codec (both audio + video)
5 * -map => maps the input files
6 */

Here, -map 0 copies all streams(audio + video) from the first input file (input_video_with_audio.avi) and -map 1 copies all streams (in this case, one i.e. audio) from the second input file (new_audio.ac3). Hence the output video will now have 2 audio streams. During playback, the user can choose the audio track to listen. (Works with players that support it, like VLC player) By default, it uses the first audio track that was mapped. (-map 0, where 0 refers to the first input file)

Remove Audio
To strip the Audio, use the -an option which tells FFmpeg to exclude all audio streams from the input.

1 ffmpeg -i inputVideo.avi -c copy -an outputVideo.avi
2 /**
3 * -i => Input file
4 * -c => codec (audio + video)
5 * -an => exclude audio streams
6 */
sveinpetter is offline   Reply With Quote
Old 03-25-2020, 07:01 PM   #7
blackshage
Human being with feelings
 
Join Date: Jan 2020
Posts: 13
Default

You can add audio tracks to video with Joyoshare Media Cutter and cause no loss to the video quality. But if my memories are correct, it only allows you to add one audio track only.
blackshage is offline   Reply With Quote
Old 03-27-2020, 03:50 PM   #8
SonicAxiom
Human being with feelings
 
SonicAxiom's Avatar
 
Join Date: Dec 2012
Location: Germany
Posts: 3,005
Default

Quote:
Originally Posted by sveinpetter View Post
This is a good one for: Encode Videos with FFmpeg
https://digitalfortress.tech/tricks/...s-with-ffmpeg/


I have copy / paste this:

6. Add/Remove Audio from a Video

While adding audio, there are 2 possibilities depending on the expected end result.

A. Replace the original Audio
You can overwrite the original audio with a new audio as shown below. By default, the duration of the output will be that of the longer input. That means that if the audio is longer than the video, the video will freeze when it reaches its end whereas the audio will continue until it reaches the end of its duration, and vice-versa.

To avoid that, you could use either use the -shortest option which truncates the output to the same duration as the shortest input or use the -t 300 option which will truncate the output at the 300th second.

1 ffmpeg -i inputAudio.mp3 -i inputVideo.avi outputVideo.avi
2 ffmpeg -i inputAudio.mp3 -i inputVideo.avi -shortest outputVideo.avi
3 ffmpeg -i inputAudio.mp3 -i inputVideo.avi -t 300 outputVideo.avi
4 /**
5 * -i => Input file
6 * -shortest => Makes output to be the same duration as the shortest input
7 * -t => time in seconds
8 */

B. Add an additional Audio track

If you wish to conserve the original audio, and only add a new audio track, it can be done by mapping the audio streams.

1 ffmpeg -i input_video_with_audio.avi -i new_audio.ac3 -map 0 -map 1 -c copy outputVideo.avi
2 /**
3 * -i => Input file
4 * -c => Codec (both audio + video)
5 * -map => maps the input files
6 */

Here, -map 0 copies all streams(audio + video) from the first input file (input_video_with_audio.avi) and -map 1 copies all streams (in this case, one i.e. audio) from the second input file (new_audio.ac3). Hence the output video will now have 2 audio streams. During playback, the user can choose the audio track to listen. (Works with players that support it, like VLC player) By default, it uses the first audio track that was mapped. (-map 0, where 0 refers to the first input file)

Remove Audio
To strip the Audio, use the -an option which tells FFmpeg to exclude all audio streams from the input.

1 ffmpeg -i inputVideo.avi -c copy -an outputVideo.avi
2 /**
3 * -i => Input file
4 * -c => codec (audio + video)
5 * -an => exclude audio streams
6 */
I really dig all the great possibilities of using ffmpeg. The only thing that turns me off is the need to fill in the actual source and output file names and the corresponding paths manually. Or can this be automated to apply batch scripts on all files located in a desired folder?

.
__________________
Check out AVConvert (free, super-fast media file manipulation via the right-click context-menu in Windows Explorer) and my free VST plugins.
My Reaper tutorials and studio related videos on youtube.
SonicAxiom is offline   Reply With Quote
Old 11-18-2020, 11:57 AM   #9
SeanTypedThis
Human being with feelings
 
Join Date: Nov 2012
Location: Oakland, CA
Posts: 103
Default

Quote:
Originally Posted by SonicAxiom View Post
I really dig all the great possibilities of using ffmpeg. The only thing that turns me off is the need to fill in the actual source and output file names and the corresponding paths manually. Or can this be automated to apply batch scripts on all files located in a desired folder?

.
Could this be what you're wanting?

Code:
 for %%X in (*.*) do
For instance, I use this batch script to create image sequences from all videos in a folder with their own separate directory:

Code:
 @echo off
echo Image sequence creator
echo **************************
echo video codec : jpg/png/bmp
echo audio codec : none
echo **************************
echo.
set /p imgformat= image format (jpg, png, bmp) :
for %%X in (*.*) do (
echo creating folder %%X_seq_%imgformat%
mkdir "%%X_seq_%imgformat%"
C:\ffmpeg\bin\ffmpeg -i "%%X" -f image2 -q 1 "%%X_seq_%imgformat%/%%X_%%05d.%imgformat%"
)
pause
__________________
YouTube
SeanTypedThis is offline   Reply With Quote
Old 11-19-2020, 08:23 AM   #10
SonicAxiom
Human being with feelings
 
SonicAxiom's Avatar
 
Join Date: Dec 2012
Location: Germany
Posts: 3,005
Default

Quote:
Originally Posted by SeanTypedThis View Post
Could this be what you're wanting?

Code:
 for %%X in (*.*) do
For instance, I use this batch script to create image sequences from all videos in a folder with their own separate directory:

Code:
 @echo off
echo Image sequence creator
echo **************************
echo video codec : jpg/png/bmp
echo audio codec : none
echo **************************
echo.
set /p imgformat= image format (jpg, png, bmp) :
for %%X in (*.*) do (
echo creating folder %%X_seq_%imgformat%
mkdir "%%X_seq_%imgformat%"
C:\ffmpeg\bin\ffmpeg -i "%%X" -f image2 -q 1 "%%X_seq_%imgformat%/%%X_%%05d.%imgformat%"
)
pause
yes, thanks. I figured this out myself in the meantime and from there I was able to put together my context-menu audio/video conversion/extraction tool AVConvert
Maybe you wanna check it out. Have a look here: https://forum.cockos.com/showthread.php?t=242201

.
__________________
Check out AVConvert (free, super-fast media file manipulation via the right-click context-menu in Windows Explorer) and my free VST plugins.
My Reaper tutorials and studio related videos on youtube.
SonicAxiom is offline   Reply With Quote
Old 11-20-2020, 11:06 AM   #11
SeanTypedThis
Human being with feelings
 
Join Date: Nov 2012
Location: Oakland, CA
Posts: 103
Default

Quote:
Originally Posted by SonicAxiom View Post
yes, thanks. I figured this out myself in the meantime and from there I was able to put together my context-menu audio/video conversion/extraction tool AVConvert
Maybe you wanna check it out. Have a look here: https://forum.cockos.com/showthread.php?t=242201

.
I just tried it out! Thanks for the amazing contribution...it'll save me the trouble of tracking down a bunch of batch files or firing up another program when I just need some quick dirty conversions.

Awesome work!
__________________
YouTube
SeanTypedThis is offline   Reply With Quote
Old 11-20-2020, 11:55 AM   #12
SonicAxiom
Human being with feelings
 
SonicAxiom's Avatar
 
Join Date: Dec 2012
Location: Germany
Posts: 3,005
Default

Quote:
Originally Posted by SeanTypedThis View Post
I just tried it out! Thanks for the amazing contribution...it'll save me the trouble of tracking down a bunch of batch files or firing up another program when I just need some quick dirty conversions.

Awesome work!
Thanks! Glad you find it useful

.
__________________
Check out AVConvert (free, super-fast media file manipulation via the right-click context-menu in Windows Explorer) and my free VST plugins.
My Reaper tutorials and studio related videos on youtube.
SonicAxiom is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 07:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.