Log in

View Full Version : remuxing AVI to MKV, adding chapters, automation


real_cheep
29th December 2007, 02:46
I've got a whole bunch of h.264/AC-3 AVIs that I need to re-mux into the MKV container, because the Popcorn Hour A-100 that I just bought loses A/V sync after fast-forwarding through my AVI files. I've figured how to do this using AVIdemux and VDubMod. However, before embarking on a project to remux several hundred GBs of video, I thought it might nice if I could also somehow insert chapter markers in the files at specific intervals (say, every 10 minutes), and if I could somehow accomplish all of this (the remuxing and the chapter marker placment) in an automated fashion, in the style of, set it, go away for the weekend, come back, find the project complete.

Any ideas? Thanks in advance

pc_speak
29th December 2007, 06:59
VirtualDubMod_1_5_10_2_b2542 handles chapters. :)
Look in 'Streams/Video Chapters'
I saved the following as CHAPTERS.TXT
It's in OGG format and imports nicely.
As a one time creation make it for a few hours and delete the chapters
not required, subject to your video lengths.


CHAPTER01=00:00:00.000
CHAPTER01NAME=Chapter 1
CHAPTER02=00:10:00.000
CHAPTER02NAME=Chapter 2
CHAPTER03=00:20:00.000
CHAPTER03NAME=Chapter 3
CHAPTER04=00:30:00.000
CHAPTER04NAME=Chapter 4
CHAPTER05=00:40:00.000
CHAPTER05NAME=Chapter 5
CHAPTER06=00:50:00.000
CHAPTER06NAME=Chapter 6
CHAPTER07=01:00:00.000
CHAPTER07NAME=Chapter 7
CHAPTER08=01:10:00.000
CHAPTER08NAME=Chapter 8
CHAPTER09=01:20:00.000
CHAPTER09NAME=Chapter 9
CHAPTER10=01:30:00.000
CHAPTER10NAME=Chapter 10

etc. etc.

Have fun. (p.s. no leading blank lines)

pc_speak
30th December 2007, 06:40
Hi real_cheep

I had another think.

Would you care to try the following batch file on one of the h.264/AC-3 AVIs
and tell me if it works?

Basically you put all your AVI files into an empty folder.
Put the chapters.txt file, per previous post, in the same folder.
Put the batch file in the same folder & run it by double clicking on it.
Probably best to try it on only one AVI first.

I tried it on a couple of AVI files, but not h.264/AC-3, and it worked OK.
Please, change the filenames and paths to suit. :)

The following, or later releases, need to be installed:
BeSweetv1.5b31.zip
aften.exe v0.07 in the Besweet folder. (great with AC3 files)
mkvmerge.exe from mkvtoolnix-unicode-2.1.0-setup.exe

Cut the following lines and paste them into a command file.
CONVERT.CMD is a nice name for a batch file. ;)

---------------------------------------------------------------------------------------------------------------
echo off
:: Extract the audio from the AVI.
FOR /F "delims=" %%W IN ('dir *.avi /b') DO "C:\VidAud\Besweet\BeSweet.exe" -core( -input "%%~nW.avi" -output "%%~nW.ac3" ) -ssrc( --rate 48000 ) -bsn( -exe aften.exe -b 192)

:: Put the video & audio back together in MKV container.
FOR /F "delims=" %%W IN ('dir *.avi /b') DO "c:\vidaud\mkvmerge.exe" -o "%%~nW.mkv" -A -S "%%W" -a 0 -D -S "%%~nW.ac3" --chapters chapters.txt
pause
---------------------------------------------------------------------------------------------------------------


Oh. Happy new year. :D