This video has not been mixed with the audio because the audio stream has a different format

Solution 1:

VLC can be automated to run via the command-line. Once the command-line is formulated, it's possible to embed it into a script.

The command-parameters are a bit complicated, but there is an easy way to have VLC create it for you.

The idea is to do manually the merge for one set of files, then create the command-line from the verbose output.

This is described in the post How can I make the following conversion in VLC from the commandline?, and especially in the answer by Alexander Higgins.

The simplified format of the command is:

vlc input --sout="[TRANSCODECOMMAND"]

Doing the merge after setting in VLC menu Tools > Messages the Verbosity to 2, will give a line such as:

qt debug: Transcode MRL: sout=#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file{no-overwrite},mux=wav,dst='C:/Users/alexh/source/repos/WaveEditor/WaveEditor/bin/Debug/samples/_AI_NylStr_MonRibb_Sft-A2-0.wav'}

Copying everything starting with #transcode gives the following command:

"C:\Program Files\VideoLAN\VLC\vlc.exe" _AI_NylStr_MonRibb_Sft-G2-0.mp3 --sout="#transcode{vcodec=none,acodec=s16l,ab=160,channels=2,samplerate=44100,scodec=none}:std{access=file,mux=wav,dst=_AI_NylStr_MonRibb_Sft-G2-0-44100k.wav}" vlc://quit

Another useful program that is very easy to use is MP4Box, which can downloaded here.

To add the audio to the video, you could do:

"C:\Program Files\GPAC\mp4box.exe" -add 1.aac 1.ts

This will do an in-place replace of 1.ts, so will destroy the original file.

To create an .mp4 video will require two lines:

"C:\Program Files\GPAC\mp4box.exe" -add 1.ts -new 1.mp4
"C:\Program Files\GPAC\mp4box.exe" -add 1.aac 1.mp4

Here is a batch script that enters all the sub-folders and creates .mp4 files from the .ts and .aac files. The target .mp4 file will have the same name as that of the video file.

The .ts and .aac files are not deleted, for safety. They can be deleted later if everything works as expected. I suggested taking a backup of the parent folder, just in case.

Here is the .bat file. It should be put inside the Parent folder.

@echo off
setlocal EnableDelayedExpansion
for /d %%D in ("*") DO (
  echo ** Entering folder : %%D
  cd "%%D"
  for %%F in (*.ts) do set "VIDEO=%%F"
  for %%G in (*.aac) do set "AUDIO=%%G"
  set "TARGET=!VIDEO:.ts=!"
  echo ** Found: Video=!VIDEO!  Audio=!AUDIO!  Target=!TARGET!
  "C:\Program Files\GPAC\mp4box.exe" -add "!VIDEO!" -new "!TARGET!.mp4"
  "C:\Program Files\GPAC\mp4box.exe" -add "!AUDIO!" "!TARGET!.mp4"
  cd ..
)

For two levels down, use two FOR /D commands:

@echo off
setlocal EnableDelayedExpansion
for /d %%D in ("*") DO (
echo ** Entering folder : %%D
cd "%%D"
for /d %%E in ("*") DO (
  echo ** Entering sub-folder : %%E
  cd "%%E"
  for %%F in (*.ts) do set "VIDEO=%%F"
  for %%G in (*.aac) do set "AUDIO=%%G"
  set "TARGET=!VIDEO:.ts=!"
  echo ** Found: Video=!VIDEO!  Audio=!AUDIO!  Target=!TARGET!
  "C:\Program Files\GPAC\mp4box.exe" -add "!VIDEO!" -new "!TARGET!.mp4"
  "C:\Program Files\GPAC\mp4box.exe" -add "!AUDIO!" "!TARGET!.mp4"
  del "!VIDEO!"
  del "!AUDIO!"
  cd ..
)
cd ..
)

Solution 2:

It probably is easier to use ffmpeg to do a quick merge of your files than to do it by loading both files in VLC simultaneously.

You can just use a command line like powershell or cmd if you prefer and write

ffmpeg -i video.ts -i audio.aac -c:v copy -c:a copy output.mp4

If you don't have ffmpeg installed, there are precompiled binaries on the official ffmpeg website.


Deeper going explanations: ffmpeg itself is a command line tool. There are so many features that a gui would inevitably be very complex and frustrating to use as it would be convoluted. There are compiled versions of ffmpeg with gui but I would not recommend to use them as they are always made for a specific purpose which never completely matches with yours. Instead I would use the command line version by gyan which indeed is linked to on the official website above. Just put it in a folder contained in your PATH variable or directly execute it from the folder. Use the command above, replace video.ts with the path to your video file, audio.aac with the path to your audio file and output.mp4 with a path to a new file that will be generated. Think of it as the usual "Save As..." option. I hope this makes it clearer.