#!/bin/bash
#
# Copyright (C) 2011 by jrierab
#
# This script usage is described in:
# http://anomenaidesa.blogspot.com/
#
# Author can be contacted there also.
#
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# Mediainfo PPA
# http://ppa.launchpad.net/shiki/mediainfo/ubuntu
_zenity="/usr/bin/zenity"
DIR="/home/jordi/Vídeos/T14_DVR/"
while [ true ]
do
DIR=$(${_zenity} --title "Escull els vídeos a unir" \
--file-selection --directory \
--filename="$DIR" )
if [ $? -eq 0 ]
then
FILES=`find $DIR/* -maxdepth 0 -name *.ts | sort | tr '\n' ' '`
if ["$FILES" -eq ""]; then
${_zenity} --error --text="No s'han trobat *.ts al directori!"
else
if [ ! -f "$DIR/000_all.mpg" ]; then
#${_zenity} --info --text "cat $FILES > $DIR/000_all.ts"
cat $FILES > $DIR/000_all.ts
ffmpeg -i $DIR/000_all.ts -map 0:0 -vcodec copy -map 0:1 -acodec copy $DIR/000_all.mpg
fi
DELAY=`mediainfo $DIR/000_all.mpg | grep Delay | tr -d "Delay relative to video :"`
${_zenity} --info --text "Fixa't en el Desplaçament de temps: $DELAY"
avidemux --load $DIR/000_all.mpg
fi
else
#${_zenity} --error --text="No s'ha escollit cap fitxer"
exit
fi
done