C'est la déstructuration d'une vidéo en modifiant les repères temporels dans les paramètres d'encodage. En clair, quand une vidéo est compressée en divx, il y a des images clefs disons toutes les secondes, ces images clefs (keyframe) contiennent toutes les infos (ou tous les pixels) pour reconstituer l'intégralité de l'image alors que les autres images (qui ne sont pas “keyframe”) ne contiennent qu'une partie de l'info (des pixels), c'est en partie comme cela qu'on “compresse” l'image, cad en ne stockant pas toutes les images intégralement dans le fichier vidéo.
InfiniteGlitch - Ben Baker-Smith
Rosa Menkam
Accouchement Sonique - Jérome Blanquet
Click on it - andrew benson
Chairlift, “Evident Utensil”
Datamosh - Yung Jake
Jacques Perconte - Impressions / teaser n°2
Yaoguai
SamsaraGlithced
Julian Zigerli X (LA)HORDE
Pouff - Grocery Trip
ffmpeg -i input_video.mov -g 250 -sc_threshold 1000000000 -vcodec libxvid output_video.mp4
Ben Baker-Smith dit: To clarify some of the Avidemux scripting stuff… First of all, a script for Avidemux can really just be an edited project file. The code is written in javascript. To check the frame type you must have already laid the whole video down in the timeline (or rather the virtual timeline when doing this from the CLI). Then use one of the following functions (depending on your version) to identify the frame type:
app.video.frameType(x); app.video.getFrameType(x);
where x is the frame number you want to check.
A result of 16 means it is a keyframe.
Because you can only check the frame types of frames already added to the timeline, you will have to lay down the entire clip, check each frame for its type and log the results in an array. Then clear the timeline again with app.clearSegments(); and start laying it down fresh frame by frame, checking against the array to be sure you don't add the keyframes.
Un script perl fort amusant sous linux AutodataMosh : https://github.com/grampajoe/Autodatamosh
Le résultat en image :
ffmpeg -i SOURCE -f avi -vcodec xvid -b 20000k -g 100 -sc_threshold 1000000000 -an -acodec copy DESTINATION
ou selon version de ffmpeg
ffmpeg -i SOURCE -f avi -vcodec libxvid -b 20000k -g 100 -sc_threshold 1000000000 -an -acodec copy DESTINATION
paramètre pour régler le pb “libxvid Invalid pixel aspect ratio 0/1”
ou codec audio
ou provenant d'une camera HD 1440×1080
ffmpeg -deinterlace -y -r 25 -s 1440x1080 -i SOURCE.MTS -f avi -vcodec libxvid -b 50000k -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -acodec libvorbis -ab 192k -ar 44100 -ac 2 DESTINATION.avi
ffmpeg -i SOURCE.avi -vcodec libxvid -qscale 1 -g 100 -me_method epzs -bf 0 -mbd 0 -aspect 16:9 -acodec copy DESTINATION.avi
compression proposée par David Olivari
ffmpeg -i in.mov -vcodec libxvid -qscale 1 -g 128 -me_method epzs -bf 0 -mbd 0 -aspect 16:9 epzs_128_out.avi
http://bazaar.launchpad.net/~david-olivari/datamosher/trunk/view/head:/readme
extraire l'audio
ffmpeg -y -i 00076.MTS -ar 44100 -vn -acodec pcm_s16le -ac 2 00076.wav
mélanger audio et vidéo
ffmpeg -y -i 00076.wav -i SOUIRCE.avi -vcodec copy -acodec copy DESTINATIONwithSound.avi
autodatamoshing 89 % de chance de mosher, si mosh répétition d'images P aléatoire entre 50 et 100
perl autodatamosh.pl -i SOURCE_ENCODEE -dprob 0.89 -dmin 50 -dmax 100 -o DESTINATION-MOSH
Recompression pour rendre la video lisible par les lecteurs video habituels :
ffmpeg -i SOURCE-MOSHED -r 25 -vcodec mjpeg -b 20000k -g 25 -an -acodec copy DESTINATION-MOSH-LISIBLE.avi
Recompression pour rendre les videos uploadables sur les plateformes de partage (vimeo, …)
ffmpeg -i MaVideoMOSH.avi -acodec copy -ab 320k -b 2000k -vc h264 -g 25 -sameq MaVideoUploadable.mp4
option : -t 30 pour ne compresser que les 30 premières secondes, -ss 15 pour décaler le début du fichier à 15 secondes du début
Recompression mpeg4 HD ffmpeg -i SOURCE.avi -s 1280×720 -acodec copy -vcodec mpeg4 -b 6000k -g 15 -f avi DESTINATION.avi
Recompression Vimeo depuis HD (ffmpeg moderne) avec preset hq
ffmpeg -i SOURCE.avi -vcodec libx264 -acodec libfaac -vpre hq -s hd720 -b 5000k -ab 320k DESTINATION.mp4
Recompression H264 .mp4
ffmpeg -threads 2 -y -i "/media/hd/source.avi" -s 1280x720 -crf 25.0 -vcodec libx264 -acodec libvo_aacenc -ar 48000 -ab 160k -coder 1 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me_method hex -subq 6 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -qcomp 0.6 -qmin 0 -qmax 69 -qdiff 4 -b 6000k "/media/hd/destination.mp4"
2ème essai video source 1440×1080 .mts AVCHD recompression pour vimeo 1280×720
ffmpeg -i 00028.MTS -deinterlace -s 1280x720 -pix_fmt yuv420p -vcodec mpeg4 -sameq -b 6000k -f mp4 -acodec copy MiasOuEst-ce_28.mp4
Exemple Video HD depuis Blue-ray
ffmpeg -i Sam.1080p.BluRay.x264-GECKOS.mkv -f avi -vcodec libxvid -b 50000k -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -b_strategy 1 -acodec libvorbis -ab 328k -ar 44100 -ac 2 /DESTINATION/Sam-Xvid-ogg.avi perl autodatamosh.pl -i /DESTINATION/Sam-Xvid-ogg.avi -dprob 1 -dmin 0 -dmax 0 -o /DESTINATION/Sam-Xvid-oggGlitech-1-0-0.avi
Au final, pour conserver l'audio, il doit falloir exporter l'audio du xvid moshé, exporter le xvid moshé en mjpeg et muxer les 2
Compression initiale en xvid (différentes stratégies possibles, cf plus haut)
ffmpeg -threads 12 -i Unborn0x9-Marseille-2020-11-13.mp4 -f avi -vcodec libxvid -b 20000k -g 25 -sc_threshold 1000000000 -acodec libvorbis -ab 192k -ar 44100 -ac 2 Unborn0x9-Marseille-2020-11-13-25audio.xvid
Datamoshing
perl autodatamosh.pl -i Unborn0x9-Marseille-2020-11-13.xvid -dprob 1 -dmin 20 -dmax 80 -o Unborn0x9-Marseille-2020-11-13.moshed128.xvid
Compression mjpeg
ffmpeg -threads 12 -i Unborn0x9-Marseille-2020-11-13.moshed128-25audio.xvid -r 25 -vcodec mjpeg -b 20000k -g 25 -an -acodec copy Unborn0x9-Marseille-2020-11-13.moshed128-25audio.mov
Extraction audio
ffmpeg -y -i Unborn0x9-Marseille-2020-11-13.moshed128-25audio.xvid -ar 44100 -vn -acodec pcm_s16le -ac 2 Unborn0x9-Marseille-2020-11-13.moshed128-25audio.wav
On remix le tout en mp4 aac
ffmpeg -threads 12 -i Unborn0x9-Marseille-2020-11-13.moshed128-25audio.wav -i Unborn0x9-Marseille-2020-11-13.moshed128-25audio.mov -c:v libx264 -profile high -c:a aac -b:a 256k Unborn0x9-Marseille-2020-11-13.moshed128-25audio.mp4
Si le résultat glitch au niveau temporel, on cut à 10 minutes
ffmpeg -threads 12 -to 9:59 -i Unborn0x9-Marseille-2020-11-13.moshed128-25audio.mp4 -c:v copy -c:a copy Unborn0x9-Marseille-2020-11-13.moshed128-25audio-10mn.mp4
Voir le résultat ; https://tube.futuretic.fr/videos/watch/c18d7c6a-6303-4f81-a20c-1df151cdb718
Pour ne recompresser qu'une partie de la vidéo :
ffmepg -ss debutensecondes.millisecondes -i nomfich.avi .... -t dureeduboutaconserverensecondes.millisecondes nomfichrecomp.avi
avec :
#!/bin/bash for i in *.mp4; do name=`echo "${i%.*}"`; echo $name; ffmpeg -i "${i}" -vcodec libxvid -qscale 1 -g 128 -me_method epzs -bf 0 -mbd 0 -aspect 16:9 "${name}".xvid.avi; perl autodatamosh.pl -i "${name}".xvid.avi -dprob 1 -dmin 0 -dmax 0 -o "${name}".xvid.moshed.avi; ffmpeg -i "${name}".xvid.moshed.avi -c:v libx264 -profile high -c:a copy -strict experimental "${name}".moshed.mp4; done
Script DataMoshing
#!/bin/bash for i in /home/gedeon/Vidéos/BANDITS/*.mp4; do name=`echo "${i%.*}"`; echo $name; ffmpeg -i "${i}" -vcodec libxvid -b 50000k -g 250 -keyint_min 25 -sc_threshold 90 -i_qfactor 0.21 -b_strategy 1 "${name}".xvid.avi; # ffmpeg -i "${i}" -vcodec libxvid -qscale 1 -g 128 -me_method epzs -bf 0 -mbd 0 -aspect 16:9 "${name}".xvid.avi; perl autodatamosh.pl -i "${name}".xvid.avi -dprob 1 -dmin 30 -dmax 100 -o "${name}".xvid.moshed.avi; ffmpeg -i "${name}".xvid.moshed.avi -r 25 -vcodec mjpeg -b 20000k -g 25 -an -acodec copy "${name}".moshed10030100.mov; rm "${name}".xvid.avi; rm "${name}".xvid.moshed.avi; done
Patchs Pure Data voir https://github.com/b01xy/montage_generatif-renarde
Pour enregistrer le système de montage generatif issu de Pd :
ffmpeg -thread_queue_size 512 -discard noref -f video4linux2 -i /dev/video0 -vcodec libx264 -profile:v high422 -preset fast -crf 18 -b-pyramid none -t 1800 /home/gedeon/Vidéos/MontagGeneCICLIC-3000_40-VIDEO$(date +%Y-%m-%d-%H:%M).mp4
Encodage H264 pour lire les vidéos sur les Pi par omxplayer
ffmpeg -i 25FPSBEAUCLIBANDITS2.ogv -vcodec libx264 -preset slow -profile:v high -level 30 -maxrate 50000000 -bufsize 10000000 -b 15M -f mp4 -threads 2 25FPSBEAUCLIBANDITS02.mp4