From: p2p p2p-next-02 Date: Mon, 28 Mar 2011 11:18:01 +0000 (+0300) Subject: video handling scripts reform: unique all file conversion script; renaming; old scrip... X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=2bd0e6d1d0bd5998078c80dab4d60fcdb96d0ed0;p=video-handling.git video handling scripts reform: unique all file conversion script; renaming; old scripts are in 'old' --- diff --git a/ffmpeg-all-extract-thumbnail b/ffmpeg-all-extract-thumbnail deleted file mode 100755 index 4aed477..0000000 --- a/ffmpeg-all-extract-thumbnail +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash -# -# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com -# -# This scripts creates thumbnails for all videos with a specified suffix. -# -# - -if [ $# -ne 2 ]; then - echo "usage: $0 root_path suffix" - exit 1 -fi - -root_path="$1" -suffix="$2" - -( -IFS=$'\n' -for filename in $(find "$root_path" -name "*$suffix"); do - new_filename=$(dirname "$filename")/$(basename "$filename" "$suffix")_tmp.jpg - new_filename1=$(dirname "$filename")/$(basename "$filename" "$suffix")_small.jpg - new_filename2=$(dirname "$filename")/$(basename "$filename" "$suffix")_big.jpg - rm -f "$new_filename1" - rm -f "$new_filename2" - ./ffmpeg-extract-thumbnail "$filename" "$new_filename" 1280x720 - ffmpeg -i "$new_filename" -s 122x69 -f image2 "$new_filename1" - ffmpeg -i "$new_filename" -s 149x84 -f image2 "$new_filename2" - rm -f "$new_filename" -done -) diff --git a/ffmpeg-all-mts2avi b/ffmpeg-all-mts2avi deleted file mode 100755 index cacebf4..0000000 --- a/ffmpeg-all-mts2avi +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -# -# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com -# -# This scripts converts all mts files to avi starting from a root directory -# recursively. The avi files are placed in the same directory as the -# original mts files. -# - -if [ $# -ne 1 ]; then - echo "usage: $0 root_path" -fi - -root_path="$1" - -for i in $(find "$root_path" -name "*.mts"); do - #echo $(dirname $i)/$(basename $i .mts).avi - ./ffmpeg-mts2avi "$i" "$(dirname $i)/$(basename $i .mts).avi" - -done diff --git a/ffmpeg-all-mts2avi-custom b/ffmpeg-all-mts2avi-custom deleted file mode 100755 index 2a6a8d0..0000000 --- a/ffmpeg-all-mts2avi-custom +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -# -# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com -# -# This scripts converts all mts files to avi starting from a root directory -# recursively. The avi files are placed in the same directory as the -# original mts files. -# - -if [ $# -ne 1 ]; then - echo "usage: $0 root_path" -fi - -root_path=$1 - -( -IFS=$'\n' -for filename in $(find "$root_path" -name '*.mts'); do - new_filename=$(dirname "$filename")/$(basename "$filename" .mts).avi - rm "$new_filename" - ./ffmpeg-mts2avi-custom "$filename" "$new_filename" 800x600 -done -) diff --git a/ffmpeg-all-mts2mp4-custom b/ffmpeg-all-mts2mp4-custom deleted file mode 100755 index a11333a..0000000 --- a/ffmpeg-all-mts2mp4-custom +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com -# -# This scripts converts all mts files to avi starting from a root directory -# recursively. The avi files are placed in the same directory as the -# original mts files. -# - -if [ $# -ne 1 ]; then - echo "usage: $0 root_path" -fi - -root_path="$1" - -#resolution=960x720 # HD -resolution=800x600 # SD - -( -IFS=$'\n' -for filename in $(find "$root_path" -name '*.mts'); do - new_filename=$(dirname "$filename")/$(basename "$filename" .mts)_SD.mp4 - rm "$new_filename" - ./ffmpeg-mts2mp4-custom "$filename" "$new_filename" $resolution 700k -done -) diff --git a/ffmpeg-cut-mts b/ffmpeg-cut-mts deleted file mode 100755 index 834242e..0000000 --- a/ffmpeg-cut-mts +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script cuts .mts video file starting from a seek point -# with a desired duration. Seek point and duration are expressed in -# seconds or in the hh:mm:ss[.xx] format. -# - -if test $# -ne 4; then - echo "Usage: $0 mts-input-file mts-output-file seek-point duration" - exit 1 -fi - -MTS_IN="$1" -MTS_OUT="$2" -SEEK_POINT="$3" -DURATION="$4" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_IN"; then - echo "Error: No such file $MTS_IN" - exit 1 -fi - -"$FFMPEG" -ss "$SEEK_POINT" -t "$DURATION" -i "$MTS_IN" -f mpegts -acodec copy -vcodec copy "$MTS_OUT" diff --git a/ffmpeg-extract-thumbnail b/ffmpeg-extract-thumbnail deleted file mode 100755 index 92e4a1d..0000000 --- a/ffmpeg-extract-thumbnail +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script extracts a thumbnail from a random frame of a video file. -# -# - -if test $# -ne 3; then - echo "Usage: $0 input-video output-image resolution" - exit 1 -fi - -IN="$1" -OUT="$2" -RESOLUTION="$3" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$IN"; then - echo "Error: No such file $IN" - exit 1 -fi - -# Choose a random frame -DURATION=$(mediainfo --Inform="General;%Duration%" "$IN" | cut -d"." -f1) -SEEK_POINT=$(($DURATION * $RANDOM / 32767 / 1000)) - -"$FFMPEG" -i "$IN" -ss "$SEEK_POINT" -vframes 1 -s "$RESOLUTION" -f image2 "$OUT" diff --git a/ffmpeg-mts2avi b/ffmpeg-mts2avi deleted file mode 100755 index 6721e44..0000000 --- a/ffmpeg-mts2avi +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an AVI file, which -# contains an H.264 video stream and and an MP3 audio stream. -# - -if test $# -ne 2; then - echo "Usage: $0 mts-file avi-file" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such: file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f avi -acodec libmp3lame -ab 256k -ar 44100 -ac 2 -vcodec libx264 -vpre normal -b 1400k -r 25 -threads 0 "$AVI_FILE" - diff --git a/ffmpeg-mts2avi-custom b/ffmpeg-mts2avi-custom deleted file mode 100755 index 232471c..0000000 --- a/ffmpeg-mts2avi-custom +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an AVI file, which -# contains an H.264 video stream and and an MP3 audio stream. -# - -if test $# -ne 4; then - echo "Usage: $0 mts-file avi-file resolution bitrate" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -RESOLUTION="$3" -BITRATE="$4" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such: file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f avi -acodec libmp3lame -ab 256k -ar 44100 -ac 2 -vcodec libx264 -vpre normal -b "$BITRATE" -r 25 -s $RESOLUTION -threads 0 "$AVI_FILE" - diff --git a/ffmpeg-mts2flv-custom b/ffmpeg-mts2flv-custom deleted file mode 100755 index ee9c2f8..0000000 --- a/ffmpeg-mts2flv-custom +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an AVI file, which -# contains an H.264 video stream and and an MP3 audio stream. -# - -if test $# -ne 3; then - echo "Usage: $0 mts-file avi-file resolution" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -RESOLUTION="$3" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such: file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f flv -acodec libmp3lame -ab 256k -ar 44100 -ac 2 -vcodec libx264 -vpre normal -b 1400k -r 25 -s $RESOLUTION -threads 0 "$AVI_FILE" - diff --git a/ffmpeg-mts2mp4-custom b/ffmpeg-mts2mp4-custom deleted file mode 100755 index 334407a..0000000 --- a/ffmpeg-mts2mp4-custom +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an AVI file, which -# contains an H.264 video stream and and an MP3 audio stream. -# - -if test $# -ne 4; then - echo "Usage: $0 mts-file avi-file resolution bitrate" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -RESOLUTION="$3" -BITRATE="$4" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such: file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f mp4 -acodec libmp3lame -ab 192k -ar 44100 -ac 2 -vcodec libx264 -vpre normal -b "$BITRATE" -r 25 -s "$RESOLUTION" -threads 0 "$AVI_FILE" - diff --git a/ffmpeg-mts2ogg b/ffmpeg-mts2ogg deleted file mode 100755 index ce30094..0000000 --- a/ffmpeg-mts2ogg +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an WebM file, which -# contains a V8 video stream and and a Vorbis audio stream. -# - -if test $# -ne 2; then - echo "Usage: $0 mts-file avi-file" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f ogg -acodec libvorbis -ab 256k -ar 44100 -ac 2 -vcodec libtheora -b 1400k -r 25 -threads 0 "$AVI_FILE" - diff --git a/ffmpeg-mts2ogg-custom b/ffmpeg-mts2ogg-custom deleted file mode 100755 index 817d5d5..0000000 --- a/ffmpeg-mts2ogg-custom +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an WebM file, which -# contains a V8 video stream and and a Vorbis audio stream. -# - -if test $# -ne 4; then - echo "Usage: $0 mts-file avi-file resolution bitrate" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -RESOLUTION="$3" -BITRATE="$4" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f ogg -acodec libvorbis -ab 256k -ar 44100 -ac 2 -vcodec libtheora -b "$BITRATE" -r 25 -s $RESOLUTION -threads 0 "$AVI_FILE" - diff --git a/ffmpeg-mts2ts-custom b/ffmpeg-mts2ts-custom deleted file mode 100755 index 34e8361..0000000 --- a/ffmpeg-mts2ts-custom +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an AVI file, which -# contains an H.264 video stream and and an MP3 audio stream. -# - -if test $# -ne 4; then - echo "Usage: $0 mts-file ts-file bitrate resolution" - exit 1 -fi - -MTS_FILE="$1" -TS_FILE="$2" -BITRATE="$3" -RESOLUTION="$4" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such: file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f mpegts -acodec libmp3lame -ab 128k -ar 44100 -ac 2 -vcodec libx264 -vpre normal -b "$BITRATE" -r 25 -s $RESOLUTION -threads 0 "$TS_FILE" diff --git a/ffmpeg-mts2webm b/ffmpeg-mts2webm deleted file mode 100755 index 6d5ddaf..0000000 --- a/ffmpeg-mts2webm +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash -# -# Calin-Andrei Burloiu, 2010, calin.burloiu@gmail.com -# -# This script converts an MTS file into an WebM file, which -# contains a V8 video stream and and a Vorbis audio stream. -# - -if test $# -ne 2; then - echo "Usage: $0 mts-file avi-file" - exit 1 -fi - -MTS_FILE="$1" -AVI_FILE="$2" -FFMPEG=/usr/bin/ffmpeg - -if test ! -f "$MTS_FILE"; then - echo "Error: No such file $MTS_FILE" - exit 1 -fi - -$FFMPEG -i "$MTS_FILE" -f webm -acodec libvorbis -ab 256k -ar 44100 -ac 2 -vcodec libvpx -b 1400k -r 25 -threads 0 "$AVI_FILE" -