Bonjour,
Script pour vieillir une vidéo.
Pour Nvidia encodage GPUIl faut obligatoirement une connection internet.
apt install ffmpeg youtube-dl
je suppose que pour debian c'est :
Charger un DVD-Vidéo et lancer le script :
Le script :
#!/bin/bash
PATH=$PATH:/sbin:/usr/sbin
## VINTAGE
## @Anonyme
## youtube-dl ffmpeg libdvdcss2
## youtube-dl -o -f best https://www.youtube.com/watch?v=oK7k0EIGlF4
## https://www.youtube.com/watch?v=zs9IsYjCrAw
## https://www.youtube.com/watch?v=aiNFF9q5OLw
# Retro Movie Camera Sound Effect
# https://www.youtube.com/watch?v=pHWHokbd5xQ
# https://www.youtube.com/watch?v=xlobOQZ9Wqk
# youtube-dl -f m4a https://www.youtube.com/watch?v=xlobOQZ9Wqk
# https://stackoverflow.com/questions/349 … ing-ffmpeg
menage () {
rm -f "$DIR/$TITLE.mkv"
rm -r "$JOBDIR"
rm -r "$SCRATCHESDIR"
}
DIR=$(xdg-user-dir DESKTOP)
DEVICE=/dev/sr0
TITLE_NUMBER=$(lsdvd "$DEVICE" | grep ^'Title: ' | wc -l)
TITLE=$(lsdvd "$DEVICE" | head -1 | awk '{print $3}')
LONGEST=$(lsdvd -x "$DEVICE" 2> /dev/null | grep "Longest track" | awk '{print$3}')
SCRATCHESDIR=/tmp/VINTAGE
JOBDIR=~/OLD_JOB
OUTPUT="$DIR/$TITLE"
SCRATCHES=$(youtube-dl --get-filename -o "%(title)s.%(ext)s" w9iQBNyn4Ac)
if [ ! -d "$SCRATCHESDIR" ]; then
mkdir "$SCRATCHESDIR"
fi
youtube-dl -o "$SCRATCHESDIR/$SCRATCHES" -f best https://www.youtube.com/watch?v=w9iQBNyn4Ac
ffmpeg -i "$SCRATCHESDIR/$SCRATCHES" -r 1 -f image2 "$SCRATCHESDIR/image_damage_effect_%4d.png"
rm "$SCRATCHESDIR/$SCRATCHES"
if [ ! -d "$JOBDIR" ]; then
mkdir "$JOBDIR"
fi
mplayer -endpos 120 -dvd-device "$DEVICE" -dumpstream dvd://"$LONGEST" -dumpfile "$JOBDIR/$TITLE.dump"
MAP_ID_STREAMS=$(lsdvd -a "$DEVICE" -t "$i" 2> /dev/null | \
grep "Language: fr" | sed -n -e "s/.*\(0x\)/\1/p" | sed -e 's/c/1c/g' | \
awk '/0x/{gsub (/^/,"-map i:")}1')
TAG="-metadata:s:a:0 language=fra"
ffmpeg -hwaccel auto -c:v mpeg2_cuvid -analyzeduration 1000M -probesize 1000M -vsync passthrough -i "$JOBDIR/$TITLE.dump" \
-map 0:v -metadata title="$TITLE" \
-c:v h264_nvenc -preset hp -profile:v high -level 4.2 \
-loglevel repeat+verbose ${MAP_ID_STREAMS} \
-c:a ac3 -b:a 160k $TAG -movflags +faststart -qmin 18 -qmax 23 \
-y "$JOBDIR/$TITLE.mkv"
DURATION=$(ffprobe "$JOBDIR/$TITLE.mkv" -show_format 2>&1 | sed -n 's/duration=//p')
echo $DURATION
ffmpeg -loop 1 -r 7 -f image2 -i "$SCRATCHESDIR/image_damage_effect_%4d.png" \
-c:v h264_nvenc -preset hp \
-filter:v scale=-720:576 -pix_fmt yuv420p \
-t $DURATION -y "$JOBDIR/SCRATCH.mkv"
ffmpeg -i "$JOBDIR/$TITLE.mkv" -i "$JOBDIR/SCRATCH.mkv" \
-loglevel repeat+verbose \
-c:v libx264 -preset veryfast \
-filter_complex "blend=all_mode='overlay':all_opacity=0.4,\
colorchannelmixer=0.98786:0.01538:0.00378:0.0:0.00698:0.99372:0.00336:0.0:0.00544:0.01068:0.98262:0.0" \
-pix_fmt yuv420p -acodec copy -y "$DIR/$TITLE.mkv" \
youtube-dl -o "$JOBDIR/%(title)s.%(ext)s" -f m4a https://www.youtube.com/watch?v=xlobOQZ9Wqk
PROJECTOR_FILM=$(youtube-dl --get-filename -o "%(title)s" -f m4a https://www.youtube.com/watch?v=xlobOQZ9Wqk)
ffmpeg -ss 00:00:03.000 -i "$JOBDIR/$PROJECTOR_FILM.m4a" -filter:a "volume=0.2" -ac 6 -acodec ac3 -b:a 160k -y "$JOBDIR/$PROJECTOR_FILM.ac3"
ffmpeg -stream_loop -1 -i "$JOBDIR/$PROJECTOR_FILM.ac3" -acodec copy -ss 00:00:00.000 -t $DURATION -y "$JOBDIR/long_output.ac3"
ffmpeg -y -i "$DIR/$TITLE.mkv" -stream_loop -1 -i "$JOBDIR/long_output.ac3" \
-filter_complex "[0:a][1:a]amix=inputs=2:duration=longest[out]" \
-map 0:v -map [out] $TAG -ss 00:00:00.000 -t $DURATION -y "$DIR/$TITLE[Vintage].mkv"
menage "$i"
Essai sur 120 secondes pour les tests.
Dernière modification par Anonyme (07-11-2019 17:36:20)