flvファイルを固定時間ごとに分割
Google Tech Talksなどの巨大な動画ファイルを5分ごとなどの短い動画に分割するスクリプト。
#!/bin/bash # div_movies.sh # This is a script to divide movies by the unit of particular times. # The divided files are named "01_movies.flv, 02_movies.flv,..." MOVIE_NAME="movie.flv" # Original movie filename MOVIE_TIME=6000 # Total time of the movie [sec] DIVIDE_TIME=300 # The unit time of the divided movies [sec] #Initialization MOVIE_NUM=01 START_TIME=0 while [ 1 ] do # A case if you don't modify video/audio encoding #mencoder -oac copy -ovc copy -ss $START_TIME -endpos $DIVIDE_TIME \ #-o ${MOVIE_NUM}_$MOVIE_NAME $MOVIE_NAME # A case if you change video encoding from flv to mpeg4 mencoder -oac mp3lame -ovc lavc -ss $START_TIME -endpos $DIVIDE_TIME \ -o ${MOVIE_NUM}_${MOVIE_NAME%.flv}.mpg $MOVIE_NAME START_TIME=$(expr $START_TIME + $DIVIDE_TIME) if [ $START_TIME -ge $MOVIE_TIME ] then exit fi MOVIE_NUM=$(expr $MOVIE_NUM + 1) MOVIE_NUM=$(printf "%02d" $MOVIE_NUM) done
This is a script to divide a flv file by the unit of particular time.