Added some helper/utility scripts.
print "$cmd\n";
if(! defined $opt_s) {
my $errno = system("$cmd");
- if($errno > 0) { $errno = $errno - 255; }
- if($errno > 1) { die "-E- mkvmerge encountered some errors with exit code $errno\n"; }
+ $errno = $errno >> 8;
+ if($errno > 1) {
+ unlink "$opt_o";
+ die "-E- mkvmerge encountered some errors with exit code $errno\n";
+ }
}
# Remove the temporary file used for the chapter generation
} else {
# Create the merged video
my $errno = system("$cmd");
- if($errno > 0) { $errno = $errno - 255; }
+ $errno = $errno >> 8;
if($errno) { die "-E- make_mkv encountered some errors with exit code $errno\n"; }
# Fix the permissions
system("chown $owner \"$video\"");
--- /dev/null
+#!/bin/bash
+
+# step 1: convert the mkv to mpg ; many mkv files do not directly get converted to mp4
+mencoder "$1" -ovc lavc -lavcopts vcodec=mpeg1video -aid 0 -oac pcm -o delete_me.mpg
+
+# step 2: convert the mpg file to mp4
+mencoder -of lavf -lavfopts format=mp4 -oac lavc -ovc lavc -lavcopts \
+aglobal=1:vglobal=1:acodec=libfaac:vcodec=mpeg4:abitrate=128:vbitrate=640:keyint=250:mbd=1:vqmax=10:lmax=10:turbo -af lavcresample=44100 \
+-vf harddup,scale=640:-3 "delete_me.mpg" -o "$1.mp4"
+
+# step 3: delete the temporary huge sized mpg file
+rm "delete_me.mpg"
--- /dev/null
+
+# MOV:
+# Video: h264 (avc1 / 0x31637661)
+# Audio: pcm_s16le
+ffmpeg -ss 00:00:00.000 -t 00:00:38.299 -i 2010-12-04.000.mkv -map 0 -vcodec copy -acodec copy test.mov
+
+# MTS:
+# Video: h264 (High)
+# Audio: ac3
+
+# MP4:
+# Video: h264 (Baseline) (avc1 / 0x31637661)
+# Audio: aac (mp4a / 0x6134706D)
+
if(defined $opt_t) { $merge_opts .= "-t "; }
if(defined $opt_r) { $merge_opts .= "-r "; }
$errno=system("$merge_videos_by_day -s \"$srcpathname\" $merge_opts");
-if($errno > 0) { $errno = $errno - 255; }
+$errno = $errno >> 8;
if($errno) { die "-E- $merge_videos_by_day encountered some errors with exit code $errno\n"; }
# Copy the videos over to the destination path
--- /dev/null
+#!/bin/bash
+
+echo "-> Removing bad header on $*"
+
+ffmpeg -ss 2 -i $* -map 0 -acodec copy -vcodec copy new.$*
+
+if [[ $? == 0 ]]; then
+ mv new.$* $*
+else
+ echo "-E- Unable to remove the bad header"
+ rm new.$*
+fi
+