Outils pour utilisateurs

Outils du site


le_datamoshing

Ceci est une ancienne révision du document !


Le DataMoshing

Le Data Moshing Qu'est-ce que c'est ?

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.

Skattak00100019.jpg

Tutoriel

Ressources, tutoriels

  • Un bon tutoriel vidéo basé sur ffmpegX et Avidemux (en 3 parties)

ffmpeg

ffmpeg -i input_video.mov -g 250 -sc_threshold 1000000000 -vcodec libxvid output_video.mp4

script Avidemux

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.

Perl

Un script perl fort amusant sous linux AutodataMosh : https://github.com/grampajoe/Autodatamosh

Le résultat en image :

Exemple pratique de datamoshing avec un script perl

Préparation de la vidéo

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”

  1. aspect 16:9 

ou codec audio

  1. acodec libvorbis -ab 192k -ar 44100 -ac 2

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

Data Moshing

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
  1. dprob 1 -dmin 0 -dmax 0 pour n'enlever que les images I et mélanger les plans sans répéter les images P

Recompression

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

Pour ne recompresser qu'une partie de la vidéo :

ffmepg -ss debutensecondes.millisecondes -i nomfich.avi .... -t dureeduboutaconserverensecondes.millisecondes nomfichrecomp.avi

avec :

  • -ss : durée en secondes.millisecondes à partie de la quelle commencer la compression
  • -t : durée à partir du point d'entrée de la compression à compresser en secondes.millisecondes

DataMoshing traitement par lot - batch

#!/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

Data Bending

Ressources complémentaires

Data Moshing

Outils

Exemples de réalisations

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'

le_datamoshing.1536232483.txt.gz · Dernière modification : 2018/09/06 11:14 de serge