CONVERT NOT MP4

This commit is contained in:
fred 2023-01-01 23:58:18 +01:00
parent 18de36cb17
commit 516b41b144
2 changed files with 7 additions and 9 deletions

View File

@ -11,6 +11,13 @@ last_char=${path:length-1:1}
MIME=$(file --mime-type -b "${path}${file}")
#################################################################################################################
############# CONVERT NOT MP4
[[ ! $MIME == "video/mp4" ]] \
&& echo "MP4 CONVERT... WAIT" \
&& ffmpeg -loglevel error -i "${path}${file}" -vf scale=-1:720 -preset slow -crf 18 -c:v libx264 -c:a aac "${path}4${file}" \
&& [[ -s "${path}4${file}" ]] && rm "${path}${file}" && mv "${path}4${file}" "${path}${file}.mp4" && file="${file}.mp4" && extension="mp4" && MIME=$(file --mime-type -b "${path}${file}")
FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${path}${file}" | cut -d "x" -f 2)
RES=${FILE_RES%?}0p
@ -35,9 +42,6 @@ PROBETIME=$(echo "0.618 * $DURATION" | bc -l | cut -d '.' -f 1)
## How many seconds are encoded by Mo ?
VTRATIO=$(echo "$DURATION / $FILE_BSIZE * 1024 * 1024" | bc -l | xargs printf "%.2f")
## CREATE SOME INDEX HOOKS
# ffmpeg -skip_frame nokey -i ${path}${file} -vsync 0 -r 30 -f image2 thumbnails-%02d.jpeg

View File

@ -66,12 +66,6 @@ MIME=$(file --mime-type -b "${path}${file}")
############# EXTEND MEDIAKEY IDENTIFATORS https://github.com/NapoleonWils0n/ffmpeg-scripts
if [[ $(echo "$MIME" | grep 'video') ]]; then
# CONVERT TO MP4
[[ ! $MIME == "video/mp4" ]] \
&& echo "MP4 CONVERT... WAIT" \
&& ffmpeg -loglevel error -i "${path}${file}" -vf scale=-1:480 -c:v libx264 -c:a aac "${path}$TITLE.mp4" \
&& rm "${path}${file}" && file="$TITLE.mp4" && extension="mp4"
## Create gifanime ## TODO Search for similarities BEFORE ADD
echo "(✜‿‿✜) GIFANIME (✜‿‿✜)"
$(${MY_PATH}/make_video_gifanim_ipfs.sh "$path" "$file" | tail -n 1)