Usted preguntó "¿ Es posible configurar los dos parámetros usando una ventana emergente? " y la respuesta es sí .
Aquí hay un ejemplo de cómo se podría hacer:
Entre la acción Solicitar elementos del buscador y la acción Ejecutar secuencia de comandos de Shell, agregue una acción Ejecutar AppleScript con el siguiente código de AppleScript :
on run {input, parameters}
display dialog "Enter the start time and length:" default answer "-ss 00:00:00 -t 00:00:00" buttons {"Cancel", "OK"} ¬
with title "Set FFMPEG Start Time and Length: -ss 00:00:00 -t 00:00:00"
set beginning of input to text returned of result
return input
end run
Luego, en la acción Ejecutar secuencia de comandos de Shell , cambie la secuencia de comandos al siguiente código :
start_time_and_length="$1"
shift
for f in "$@"
do
/usr/local/Cellar/ffmpeg/3.2.4/bin/ffmpeg -i "$f" $start_time_and_length -c:v copy -c:a copy -f mp4 "${f%.*}.mp4"
done
Cómo funciona esto:
La acción Solicitar elementos del buscador pasa una de los objetos del sistema de archivos a la siguiente acción .list
La acción Ejecutar AppleScript usa a para agregar la hora de inicio y la duración al comienzo de lo que se le pasó desde la acción Preguntar elementos del buscador .display dialog
list
La acción Ejecutar Shell Script recibe lo que devolvió la acción Ejecutar AppleScript , en este caso el valor de as a en el que su primera es from the of the , siendo la hora de inicio y la duración. Esto se establece en la variable y luego se usa para eliminarlo del que se pasa para procesar el resto en el . return input
list
item
text returned
result
display dialog
start_time_and_length
shift
list
for f in "$@"
items
list
Nota: Si tiene un problema al usar el código AppleScript , que se muestra arriba, puede usar lo siguiente como solución alternativa:
on run {input, parameters}
set tempList to {}
display dialog "Enter the start time and length:" default answer "-ss 00:00:00 -t 00:00:00" buttons {"Cancel", "OK"} ¬
with title "Set FFMPEG Start Time and Length: -ss 00:00:00 -t 00:00:00"
set end of tempList to text returned of result
repeat with i from 1 to (count of input)
set end of tempList to item i of input
end repeat
copy tempList to input
return input
end run
Chile