Permalink
Browse files

add merge.mts for merging MTS files directly to mkv

  • Loading branch information...
1 parent 610e804 commit 10e573d2b0e8a5ef41637eb35c5c4946631dd09b @tgulacsi committed May 1, 2012
Showing with 32 additions and 4 deletions.
  1. +25 −0 bin/merge.mts
  2. +7 −4 bin/py_egg
View
25 bin/merge.mts
@@ -0,0 +1,25 @@
+#!/bin/bash
+CMD="mkvmerge -o $1"
+shift
+i=0
+for mts in "$@"; do
+ mkv=$(basename $mts .MTS).mkv
+ MKV="avconv -i $mts -vcodec copy -acodec copy -f matroska $mkv"
+ echo $MKV
+ $MKV || exit $?
+ nm=$mkv
+
+ new=$(echo "$nm" | sed -e 's/ .*\././')
+ [ "x$new" != "x$nm" ] && mv "$nm" "$new"
+ #echo "$nm = $new ($CMD)"
+ if [ $i -lt 1 ]; then
+ CMD="$CMD $new"
+ else
+ CMD="$CMD +$new"
+ fi
+ i=$(($i+1))
+done
+
+echo $CMD
+$CMD
+echo $CMD
View
11 bin/py_egg
@@ -1,10 +1,13 @@
#!/bin/sh
# -*- coding: utf-8 -*-
-DEST=/tmp/xx-$$
-git clone "$1" $DEST \
-&& cd $DEST \
+case "$1" in
+ *://*) DEST=/tmp/xx-$$
+ git clone "$1" $DEST || exit $? ;;
+ *) DEST="$1"
+esac
+cd $DEST \
&& python setup.py bdist_egg -k \
&& cd build/bdist.linux-x86_64/egg \
-&& find . -name '*.py[cod]' -delete \
+&& find . \( -name '*.py[cod]' -o -name '*.so' \) -delete \
&& zip -r9 $(ls ../../../dist/*.egg|head -n1|sed -e 's/-py.*\.egg$/.egg/') *

0 comments on commit 10e573d

Please sign in to comment.