mirror of
https://github.com/YunoHost-Apps/streama_ynh.git
synced 2024-09-03 20:26:30 +02:00
Update and rename convert.sh to convert_ffmpeg
This commit is contained in:
parent
ef625b36be
commit
29334caf37
2 changed files with 75 additions and 23 deletions
|
@ -1,23 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# About: Convert movies automatically
|
|
||||||
# Author: liberodark
|
|
||||||
# Thanks :
|
|
||||||
# License: GNU GPLv3
|
|
||||||
|
|
||||||
version="0.1.0"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST AND VAR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
lock="/tmp/convert_movies.lock"
|
|
||||||
|
|
||||||
exec 9>"${lock}"
|
|
||||||
flock -n 9 || exit
|
|
||||||
|
|
||||||
while IFS= read -r -d '' file
|
|
||||||
do
|
|
||||||
ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4"
|
|
||||||
rm -f "$file"
|
|
||||||
done < <(find /home/yunohost.app/streama/ -name '*.mkv' -print0 -o -name '*.avi' -print0)
|
|
75
conf/convert_ffmpeg
Normal file
75
conf/convert_ffmpeg
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# About: Convert movies automatically
|
||||||
|
# Author: liberodark
|
||||||
|
# Thanks :
|
||||||
|
# License: GNU GPLv3
|
||||||
|
|
||||||
|
version="0.1.0"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST AND VAR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
lock="/tmp/convert_movies.lock"
|
||||||
|
|
||||||
|
exec 9>"${lock}"
|
||||||
|
flock -n 9 || exit
|
||||||
|
|
||||||
|
usage ()
|
||||||
|
{
|
||||||
|
echo "usage: -ffmpeg or -avidemux"
|
||||||
|
echo "options:"
|
||||||
|
echo "-ffmpeg: Convert with ffmpeg"
|
||||||
|
echo "-remove: Convert with avidemux"
|
||||||
|
echo "-h: Show help"
|
||||||
|
}
|
||||||
|
|
||||||
|
ffmpeg_convert(){
|
||||||
|
while IFS= read -r -d '' file
|
||||||
|
do
|
||||||
|
ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4"
|
||||||
|
rm -f "$file"
|
||||||
|
done < <(find /home/yunohost.app/streama/ -name '*.mkv' -print0 -o -name '*.avi' -print0)
|
||||||
|
}
|
||||||
|
|
||||||
|
avidemux_convert(){
|
||||||
|
VIDEOCODEC="mp4"
|
||||||
|
AUDIOCODEC="aac"
|
||||||
|
while IFS= read -r -d '' file
|
||||||
|
do
|
||||||
|
#ffmpeg -nostdin -i "$file" -vcodec h264 -acodec aac -strict -2 "${file%.*}.mp4"
|
||||||
|
avidemux3_cli --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$file" --save "${file%.*}.mp4" --quit
|
||||||
|
rm -f "$file"
|
||||||
|
done < <(find /home/pc/Téléchargements/odrive-bin/ -name '*.mkv' -print0 -o -name '*.avi' -print0)
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args ()
|
||||||
|
{
|
||||||
|
while [ $# -ne 0 ]
|
||||||
|
do
|
||||||
|
case "${1}" in
|
||||||
|
-ffmpeg)
|
||||||
|
shift
|
||||||
|
ffmpeg_convert >&2
|
||||||
|
;;
|
||||||
|
-avidemux)
|
||||||
|
shift
|
||||||
|
avidemux_convert >&2
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Invalid argument : ${1}" >&2
|
||||||
|
usage >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
parse_args "$@"
|
Loading…
Add table
Reference in a new issue