tc-video-custom: improved multifile support, added comments on concat

master
Pierre Neidhardt 2013-08-04 18:28:34 +02:00
parent 818510c89a
commit 0f4a047f7d
2 changed files with 50 additions and 21 deletions

View File

@ -64,14 +64,11 @@ _transcode ###FILELIST
## Or one after another. ## Or one after another.
# while read -r i; do # while read -r i; do
# _transcode "$i" # _transcode "$i"
# done<<EOF # done<<FILELINES
# ###FILELINES # FILELINES
# EOF
################################################################################ ################################################################################
## Help ## USE CASES
##
## Intersting options:
## ##
## Exchange stream 1 an 2 by first removing them, then reading them in the ## Exchange stream 1 an 2 by first removing them, then reading them in the
## desired order. ## desired order.
@ -85,21 +82,32 @@ _transcode ###FILELIST
## Demux audio: ## Demux audio:
## -vn -sn -c:a copy -map 0:1 ## -vn -sn -c:a copy -map 0:1
## ##
## To dump audio to an ogg file: ## Dump audio to an ogg file:
## -vn -c:a libvorbis -b:a 192k ## -vn -c:a libvorbis -b:a 192k
## ##
## Add a delay to audio (assuming stream 0 is video and stream 1 is audio) ## Add a delay to audio (assuming stream 0 is video and stream 1 is audio)
## -i "$1" -itsoffset 0.300 -i "$1" -map 0:0 -map 1:1 ## -i "$1" -itsoffset 0.300 -i "$1" -map 0:0 -map 1:1
## ##
## To check what fmmpeg supports: ## Concatenate files:
## $ ffmpeg -codecs ## -filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]' -map '[v]' -map '[a]'
## $ ffmpeg -formats ## See
## https://trac.ffmpeg.org/wiki/How%20to%20concatenate%20(join,%20merge)%20media%20files
## for more details
################################################################################
################################################################################
## SOUND
## ##
## Useful guides: ## You should consider mixing down audio to 2 channels with '-ac
## x264: http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide ## 2'. This greatly reduce file size and avoid any confusion for playback, which
## ID3 details: http://en.wikipedia.org/wiki/ID3 ## is often the case when converting DTS to any other format because DTS has
## embedded channel description which is not available in other formats.
################################################################################
################################################################################
## X264 OPTIONS
## ##
## Presets: ## x264 presets (-preset <preset>).
## quality*size ~= 1/speed ## quality*size ~= 1/speed
## ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo ## ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo
## ##
@ -117,9 +125,26 @@ _transcode ###FILELIST
## Possible values: hex, umh... ## Possible values: hex, umh...
## me=umh is default. ## me=umh is default.
## ##
## WARNING: you should consider mixing down audio to 2 channels with '-ac
## 2'. This greatly reduce file size and avoid any confusion for playback, which
## is often the case when converting DTS to any other format because DTS has
## embedded channel description which is not available in other formats.
## ##
################################################################################ ################################################################################
################################################################################
## FALLACIOUS INPUT
##
## In general, FFmpeg is not so good at copying fallacious streams. Specifying
## video and audio encoding helps.
##
## "Can't write packet with unknown timestamp"
## => Put '-fflags genpts' before the input command.
################################################################################
################################################################################
## MISC
## To check what fmmpeg supports:
## $ ffmpeg -codecs
## $ ffmpeg -formats
##
## Useful guides:
## x264: http://ffmpeg.org/trac/ffmpeg/wiki/x264EncodingGuide
## ID3 details: http://en.wikipedia.org/wiki/ID3
################################################################################

View File

@ -29,8 +29,6 @@ fi
for i ; do for i ; do
REAL="$(realpath "$i")" REAL="$(realpath "$i")"
FILELIST="${FILELIST:+$FILELIST }'$REAL'" FILELIST="${FILELIST:+$FILELIST }'$REAL'"
FILELINES="${FILELINES:+$FILELINES
}$REAL"
done done
SCRIPT_PATH="${0%/*}" SCRIPT_PATH="${0%/*}"
@ -38,8 +36,14 @@ SCRIPT_NAME="${0##*/}"
OUTPUT_NAME="tc-video" OUTPUT_NAME="tc-video"
if [ -f "$SCRIPT_PATH/.$SCRIPT_NAME.in" ]; then if [ -f "$SCRIPT_PATH/.$SCRIPT_NAME.in" ]; then
cp -i "$SCRIPT_PATH/.$SCRIPT_NAME.in" "$OUTPUT_NAME" cp -i "$SCRIPT_PATH/.$SCRIPT_NAME.in" "$OUTPUT_NAME"
# echo "$FILELIST"
# echo "$FILELINES"
sed -i 's|###FILELIST|'"$FILELIST"'|' "$OUTPUT_NAME" sed -i 's|###FILELIST|'"$FILELIST"'|' "$OUTPUT_NAME"
sed -i 's|###FILELINES|'"$FILELINES"'|' "$OUTPUT_NAME" for i ; do
REAL="$(realpath "$i")"
sed -i "s|# FILELINES|# $REAL\n# FILELINES|" "$OUTPUT_NAME"
done
sed -i "s|###FILELINES||" "$OUTPUT_NAME"
chmod +x "$OUTPUT_NAME" chmod +x "$OUTPUT_NAME"
else else
echo ".$SCRIPT_NAME.in not found!" echo ".$SCRIPT_NAME.in not found!"