Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
11th July 2021, 17:41 | #1 | Link |
Registered User
Join Date: Apr 2017
Posts: 63
|
Replace video with new video on many mkv
I have a few MKVs I want to replace the video track
I can't figure out how to do this scripted (in this case powershell, but I'm fine even with batch). the principle is always like that: * New Video Track (to be added) * Old Video Track (to be removed) * Audio (everything else kept) * subs * chapter, global etc. So, keep everything else while replacing the video with another file (always same name). any pointers, examples? Last edited by _kermit; 11th July 2021 at 19:00. |
11th July 2021, 18:03 | #2 | Link |
Life's clearer in 4K UHD
Join Date: Jun 2003
Location: Notts, UK
Posts: 12,219
|
You can add and remove, video, audio and subtitle tracks/streams using MKVToolNix GUI
__________________
| I've been testing hardware media playback devices and software A/V encoders and decoders since 2001 | My Network Layout & A/V Gear |
|
14th July 2021, 21:02 | #4 | Link |
Registered User
Join Date: Aug 2013
Posts: 191
|
This is very basic. Test & see if something like this works for you.
MUX - V_A - out.mkv.BAT: Code:
@ECHO OFF ECHO MUX 0:VIDEO:CLIP:0 with 1:AUDIO:CLIP:0 -- *IN THAT ORDER, only!* ECHO much like how Video To Video does it, as opposed to "MUX" which is ECHO really a "JOIN" ECHO. ECHO therube 02/09/2015 ECHO. ECHO VIDEO: ECHO %1 ECHO AUDIO: ECHO %2 ECHO. ECHO OUTPUT TO .mkv, as that allows stuff like mp4 vid + opus aud, which won't work in .mp4 ECHO. PAUSE ECHO. SET OUT=C:\OUT ECHO OUT=: %OUT% SET OFILE=%OUT%\%~n1_MUX_AV%~x1.mkv ECHO Output filename: ECHO "%OFILE%" SET LOG=%OUT%\MUX_AV.TXT ECHO. PAUSE SET VIDEO=%1 SET AUDIO=%2 ECHO %VIDEO% > %LOG% ECHO %AUDIO% >> %LOG% ECHO. >> %LOG% ECHO ffmpeg >> %LOG% ECHO -i %VIDEO% >> %LOG% ECHO -i %AUDIO% >> %LOG% ECHO -c copy -map 0:v:0 -map 1:a:0 -bsf:a aac_adtstoasc >> %LOG% ECHO "%OFILE%" >> %LOG% ECHO. >> %LOG% ECHO ========================================================================================= >> %LOG% ECHO. >> %LOG% SF %LOG% PAUSE :: ffmpeg -i %VIDEO% -i %AUDIO% -c copy -map 0:v:0 -map 1:a:0 -bsf:a aac_adtstoasc "%OFILE%" 2>&1 | tee -a %LOG% ffmpeg -i %VIDEO% -i %AUDIO% -c copy -map 0:v:0 -map 1:a:0 "%OFILE%" 2>&1 | tee -a %LOG% ECHO. PAUSE touch "%OFILE%" --reference=%1 PAUSE EXIT You would want to adjust it such that the video track is replaced. The file with your video & the file with your audio need to be in that order, video, then audio (at least as written above). Touch is the UNIX touch command. Can be ignored if you don't care about setting the file's date to that of the existing (video) file. tee is the UNIX tee command. SF is (a renamed) ShowTx. Simply substitute (Windows) TYPE if you want. Last edited by therube; 14th July 2021 at 21:09. |
15th July 2021, 12:42 | #5 | Link | |
Registered User
Join Date: Apr 2017
Posts: 63
|
Quote:
Would the remaining parts of the original mkv be kept for the new one when just replacing the video? |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|