Soy nuevo en scripts y automatización, pero escribí un script para ayudarme en mi trabajo diario de marca de agua y grabar en el código de tiempo en los videos.
Creé una aplicación Automator Drop para convertir videos y marcas de agua y funciona perfectamente, pero estaba tratando de incluir también grabar en el código de tiempo, entonces ya no funciona.
¿Puede alguien ayudarme?
Este es el script que funciona bien, cuando coloco un video en él, se abre una ventana de terminal y se procesa el video
on run {input, parameters}
tell application "Terminal"
activate
set filesString to ""
repeat with file_ in input
set filesString to filesString & " " & quoted form of (POSIX path of file_)
end repeat
do script "for f in" & filesString & "; do
/usr/local/bin/ffmpeg -i \"$f\" -vf \"drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=name_one:x=510:y=1000:fontsize=80:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=name_two:x=390:y=10:fontsize=65:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=name_three:x=200:y=280:fontsize=65:[email protected]\" -s 1280x720 -c:v libx264 -b:v 4000k -pix_fmt yuv420p -b:a 192k ${f%.*}_output_name.mov
done"
end tell
return input
end run
Cuando hice lo mismo con el código de tiempo drawtext, no funcionó.
on run {input, parameters}
tell application "Terminal"
activate
set filesString to ""
repeat with file_ in input
set filesString to filesString & " " & quoted form of (POSIX path of file_)
end repeat
do script "for f in" & filesString & "; do
/usr/local/bin/ffmpeg -i \"$f\" -vf \"drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=text_one:x=(w-text_w)/2:y=1000:fontsize=80:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=text_two:x=(w-text_w)/2:y=10:fontsize=65:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=text_three:x=200:y=280:fontsize=65:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:timecode=01:00:00:00:r=25:x=200:y=150:fontsize=50:[email protected]:box=1:[email protected]\" -s 1280x720 -c:v libx264 -b:v 4000k -pix_fmt yuv420p -b:a 192k ${f%.*}_output_name.mov
done"
end tell
return input
end run
¿Puede alguien ayudarme a detectar el error? Si lo hace, por favor, considere que está hablando con un niño de 5 años, por favor. LOL
Salida de terminal
rafaels-mbp-3:~ Rafael$ for f in '/Users/Rafael/Desktop/test/1645c.mov'; do
> /usr/local/bin/ffmpeg -i "$f" -vf "drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=text_one:x=(w-text_w)/2:y=1000:fontsize=80:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=text_two:x=(w-text_w)/2:y=10:fontsize=65:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:text=text_three:x=200:y=280:fontsize=65:[email protected], drawtext=fontfile=/Library/Fonts/Tahoma.ttf:timecode=01:00:00:00:r=25:x=200:y=150:fontsize=50:[email protected]:box=1:[email protected]" -s 1280x720 -c:v libx264 -b:v 4000k -pix_fmt yuv420p -b:a 192k ${f%.*}_output_name.mov
> done
ffmpeg version 2.5 Copyright (c) 2000-2014 the FFmpeg developers
built on Dec 15 2014 19:45:57 with Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags='-I/usr/local/Cellar/openjpeg/1.5.1_1/include/openjpeg-1.5 ' --enable-nonfree --enable-vda
libavutil 54. 15.100 / 54. 15.100
libavcodec 56. 13.100 / 56. 13.100
libavformat 56. 15.102 / 56. 15.102
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fac71821800] multiple edit list entries, a/v desync might occur, patch welcome
Last message repeated 1 times
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/Rafael/Desktop/test/1645c.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2015-04-08 16:17:54
Duration: 00:00:07.42, start: -2.166667, bitrate: 173782 kb/s
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 116571 kb/s, 24 fps, 24 tbr, 24 tbn, 48 tbc (default)
Metadata:
creation_time : 2015-04-08 16:17:54
handler_name : Apple Alias Data Handler
encoder : H.264
timecode : 01:59:52:00
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2015-04-08 16:17:54
handler_name : Apple Alias Data Handler
Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2015-04-08 16:17:54
handler_name : Apple Alias Data Handler
reel_name : AW_LR2
timecode : 01:59:52:00
[Parsed_drawtext_3 @ 0x7fac717087a0] Both text and text file provided. Please provide only one
[AVFilterGraph @ 0x7fac71601d20] Error initializing filter 'drawtext' with args 'fontfile=/Library/Fonts/Tahoma.ttf:timecode=01:00:00:00:r=25:x=200:y=150:fontsize=50:[email protected]:box=1:[email protected]'
Error opening filters!
rafaels-mbp-3:~ Rafael$