root/trunk/install/perl/transcode/vfr4psp.sh

リビジョン 1, 2.1 kB (コミッタ: jplcom, コミット時期: 18 年 前)

initial import

  • svn:executable 属性の設定値:
Line 
1 #! /bin/sh
2 # This script based http://www.kokone.to/~kgt/diary.shtml?200501#23_3
3
4 # vi:set ts=4 sw=4:
5
6 umask 7077
7
8 START_OPT=""
9 DURATION_OPT=""
10
11
12 cd $3
13
14 NUMBER=$2
15 #if [ "$NUMBER" -eq "" ]
16 #then
17 #
18 #NUMBER_FILE=$HOME/.psp_movie_number
19 #NUMBER=`(cat $NUMBER_FILE | grep '^[0-9]*$' | head -1) 2> /dev/null`
20 #if [ "$NUMBER" -eq "" ]
21 #then
22 #       NUMBER=1
23 #else
24 #       NUMBER=`expr $NUMBER + 1`
25 #fi
26 #echo $NUMBER > $NUMBER_FILE
27 #fi
28
29 # OUTPUT=`printf "M4V%05d.MP4" $NUMBER`
30 OUTPUT="M4V$NUMBER.MP4"
31
32 PREFIX=`mktemp -d 4psp-XXXXXXX`
33 TMP_M4V="$PREFIX/temporary.m4v"
34 TMP_LOG="$PREFIX/temporary"
35 TMP_S16="$PREFIX/temporary.s16"
36 TMP_PCM="$PREFIX/temporary.s16"
37 #TMP_PCM="$PREFIX/temporary.pcm"
38 TMP_AAC="$PREFIX/temporary.aac"
39
40 #
41 # Encode
42 #
43
44 rm -f $TMP_M4V $TMP_S16
45
46 ASPECT=$4
47 if [ "$ASPECT" -eq "" ]
48 then
49 ASPECT="3";
50 fi
51
52 if [ "$ASPECT" -eq "16" ]
53 then
54 #16:9
55 /usr/local/bin/ffmpeg -y -i $1 -vcodec xvid -croptop 70 -cropbottom 60 -cropleft  8 -cropright 14 -s 320x240 -b 300 -bt 128 -r 14.985  -hq -nr -qns -bufsize 192 -maxrate 512 -minrate 0  -deinterlace  -acodec pcm_s16le -ar 24000 -ac 2 -f m4v $TMP_M4V -f s16le $TMP_S16
56
57 else
58 #3:4
59 /usr/local/bin/ffmpeg -y -i $1 -vcodec xvid -croptop 8 -cropbottom 8 -cropleft  8 -cropright 14 -s 320x240 -b 300 -bt 128 -r 14.985  -hq -nr -qns -bufsize 192 -maxrate 512 -minrate 0 -deinterlace  -acodec pcm_s16le -ar 24000 -ac 2 -f m4v $TMP_M4V -f s16le $TMP_S16
60
61 fi
62
63 # delay audio, 300->125msec (x24)
64 #dd if=/dev/zero bs=4 count=7200 of=$TMP_PCM 2> /dev/null
65 #dd if=/dev/zero bs=4 count=3000 of=$TMP_PCM 2> /dev/null
66 #cat $TMP_S16 >> $TMP_PCM
67
68
69 # AAC encode
70 /usr/local/bin/faac -o $TMP_AAC -q 100 -b 96 -R 24000 -B 16 -C 2 -X --mpeg-vers 4 --obj-type LC $TMP_PCM
71
72
73 #
74 # Build MP4 system file
75 #
76 TIMESTUMP=`date "+%Y%m%d-%H%M%S"`
77
78 if [ -s $OUTPUT ]
79 then
80 #echo EXIST
81 #mv $OUTPUT $OUTPUT.$TIMESTUMP.MP4
82 OUTPUT=$OUTPUT.$TIMESTUMP.MP4
83 fi
84
85 # Add video track
86 /usr/local/bin/mp4creator  -r 14.985 --create=$TMP_M4V $OUTPUT
87
88 # Add audio track
89 /usr/local/bin/mp4creator -aac-profile=4 $TMP_AAC $OUTPUT
90
91 # Delete invaid track
92 /usr/local/bin/mp4creator -delete=5 $OUTPUT
93 /usr/local/bin/mp4creator -delete=6 $OUTPUT
94
95 #
96 # Post process
97 #
98 rm -fr $PREFIX
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed