[bugfix] cover function

This commit is contained in:
Klesh Wong 2020-12-20 10:56:53 +08:00
parent 077c42b9ec
commit 397f06bedf
2 changed files with 9 additions and 10 deletions

View File

@ -13,7 +13,7 @@ function cut -a infile from to outfile -d "cut out portion to new media file"
help help
exit 1 exit 1
end end
ffmpeg -ss $from -i $infile -t to -c copy $outfile ffmpeg -ss $from -i $infile -t $to -c copy $outfile
end end
function cover -a infile outfile title gravity x y -d "create cover" function cover -a infile outfile title gravity x y -d "create cover"
@ -32,7 +32,7 @@ function cover -a infile outfile title gravity x y -d "create cover"
-pointsize 120 -font "$SC_FONT" \ -pointsize 120 -font "$SC_FONT" \
-fill '#fdf6e3' -stroke '#fdf6e3' -strokewidth 40 \ -fill '#fdf6e3' -stroke '#fdf6e3' -strokewidth 40 \
-annotate +$x+$y "$title"\ -annotate +$x+$y "$title"\
-fill '#839496' -stroke '#839496' -strokewidth 5 \ -fill '#839496' -stroke '#839496' -strokewidth 0 \
-annotate +$x+$y "$title"\ -annotate +$x+$y "$title"\
$outfile $outfile
end end
@ -45,7 +45,6 @@ function chapter -a infile outfile title duration gravity -d "prepend chapter to
test -z $duration && set duration 3 test -z $duration && set duration 3
set tmpjpeg /tmp/tmpjpeg.jpg set tmpjpeg /tmp/tmpjpeg.jpg
set tmpcover /tmp/tmpcover.jpg set tmpcover /tmp/tmpcover.jpg
set tmpchapter /tmp/chapter.mp4
ffmpeg -i $infile -vframes 1 -f image2 -y $tmpjpeg ffmpeg -i $infile -vframes 1 -f image2 -y $tmpjpeg
cover $tmpjpeg $tmpcover $title cover $tmpjpeg $tmpcover $title
ffmpeg \ ffmpeg \
@ -57,8 +56,7 @@ function chapter -a infile outfile title duration gravity -d "prepend chapter to
[1:v][v0]overlay" \ [1:v][v0]overlay" \
-c:v h264 -crf 0 -preset ultrafast -pix_fmt yuv444p \ -c:v h264 -crf 0 -preset ultrafast -pix_fmt yuv444p \
-t 5 \ -t 5 \
-y $tmpchapter -y $outfile
join $outfile $tmpchapter $infile
preview $outfile preview $outfile
end end
@ -89,6 +87,7 @@ function help
echo " commads:" echo " commads:"
echo " preview <infile>" echo " preview <infile>"
echo " cut <infile> <from> <to>" echo " cut <infile> <from> <to>"
echo " cover <infile> <outfile> <title>"
echo " chapter <infile> <title>" echo " chapter <infile> <title>"
echo " join <outfiles> <...infiles>" echo " join <outfiles> <...infiles>"
echo " concat <indir> <outfile>" echo " concat <indir> <outfile>"
@ -100,7 +99,7 @@ if test (count $argv) -lt 2
end end
switch $argv[1] switch $argv[1]
case preview cut join concat chapter help case preview cut join concat cover chapter help
$argv $argv
case "*" case "*"
help help

View File

@ -11,10 +11,10 @@ function mark_end()
end end
function output_marked() function output_marked()
--if not begin_pos and not end_pos then if not begin_pos and not end_pos then
--mp.osd_message('Please set Begin Position with Ctrl-b, End Position with Ctrl-e') mp.osd_message('Please set Begin Position with Ctrl-b, End Position with Ctrl-e')
--return return
--end end
ss = begin_pos or 0 ss = begin_pos or 0
t = end_pos or mp.get_property('duration') t = end_pos or mp.get_property('duration')
path = mp.get_property('path') path = mp.get_property('path')