Benutzer-Werkzeuge

Webseiten-Werkzeuge


wiki:video_repair

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.

Link zu der Vergleichsansicht

Beide Seiten, vorherige ÜberarbeitungVorherige Überarbeitung
Nächste Überarbeitung
Vorherige Überarbeitung
Nächste ÜberarbeitungBeide Seiten, nächste Überarbeitung
wiki:video_repair [2020/06/19 22:26] – [mplayer mencoder] pulsarwiki:video_repair [2021/03/14 15:03] – [Untrunc] pulsar
Zeile 1: Zeile 1:
 +
 +===== Videos Encodieren =====
 +
 +Manche Videos lassen sich nicht abspielen wegen Codec Warnung, daher muss man manche Videos umwandeln wenn man keine Codecs installieren mag. Dies gelang gut mit ''HandBrake''. Dort hatte ich ein .mp4 Video geladen welches sich nicht unter VLC abspielen ließ(hat Codecs vermisst) Mit Handbrake konnte ich es in .webm Format umwandeln und nun läuft es überall. Es ist dabei aber auch größer geworden von 20 MB auf 40 MB gewachsen.
 +
 +Im weiteren Schritt ließ es sich nun auch mit ''ffmpeg'' bearbeiten. Es ging mir darum die Zeitdauer des Videos zu minimieren.
 +
  
 ===== Videos reparieren ===== ===== Videos reparieren =====
Zeile 12: Zeile 19:
 Man kann versuchen die defekte Video-Datei mit ''mencoder'' umzuwandeln und so evtl. zu reparieren: Man kann versuchen die defekte Video-Datei mit ''mencoder'' umzuwandeln und so evtl. zu reparieren:
  
-  mencoder -forceidx -oac copy -ovc copy corruptvideo.mp4 -o fixedvideo.avi+  mencoder -forceidx -oac pcm -ovc copy corruptvideo.mp4 -o fixedvideo.avi
  
      
Zeile 25: Zeile 32:
 to keep the input images at their original size. Examples: to keep the input images at their original size. Examples:
  
-  -vf scale=1280:828 +<code> 
-  -vf scale=1280:-1+-vf scale=1280:828 
 +-vf scale=1280:-1 
 +</code>
  
 These two scale examples would both resize your 1700x1100 input to 1280x828. The -1 tells ffmpeg to scale These two scale examples would both resize your 1700x1100 input to 1280x828. The -1 tells ffmpeg to scale
Zeile 47: Zeile 56:
  
   ffmpeg -i "So Live.avi" -acodec copy -vcodec copy So_Live.avi   ffmpeg -i "So Live.avi" -acodec copy -vcodec copy So_Live.avi
-==== Untrunc ====+   
 +Hiermit wird das Video richtig klein, indem die Framsize verkleiner wird. Von 40 MB auf 5 MB verkleinert.
  
-  * https://github.com/ponchio/untrunc +  ffmpeg -i The\ Run\ of\ the\ Golden\ Bull.webm -vf "scale=iw/2:ih/2" half_the_frame_size.mkv 
-  * http://vcg.isti.cnr.it/~ponchio/untrunc.php+   
 +oder
  
-It is possible to repair the broken mp4 or m4v file using UntruncFor this method you need:+  ffmpeg -i input.mkv -vf "scale=iw/3:ih/3" a_third_the_frame_size.mkv 
 +   
 +  
 +Nur die ersten 30 Sekunden eines Videos in eine neue Datei speichern
  
-another video file which isn'broken+  ffmpeg -i half_the_frame_size.mkv -00:00:30 TheRunoftheGoldenBull.mkv
  
-and Install some pre-requisite libraries with apt or zypper:+Aus der Mitte eines Video einen bestimmten Bereich wählen. Hier ab der 11. Sekunde und ab da 31 Sekunden weiter.
  
-  sudo apt install libavformat-dev libavcodec-dev libavutil-dev+  ffmpeg -ss 00:00:11 -i half_the_frame_size.mkv -t 31 -c copy supershort01.mkv 
 +   
 +   
 +Video beschleunigen
  
-Unter Suse benötigte ich noch das Paket zlib-devel+  ffmpeg -i 20210112_15171777.mp4 -filter:v "setpts=0.5*PTS" output_fast.mp4 
 +   
 +Video verlangsamen
  
-  zypper in zlib-devel+  ffmpeg -i 20210112_15171777.mp4 -filter:v "setpts=2.0*PTS" output_slow.mp4
  
  
-This is what to do:+Zwei einzelne Video Dateien zusammenfügen. Hierzu müssen die beiden oder mehrere Dateien untereinander in einer Text Datei eingetragen werden: 
 +  
 +<code> 
 +cat files.txt 
 +file '20210112_150713_mid4.mp4' 
 +file '20210112_150713_midmid.mp4' 
 +</code>
  
-   +Anschließend beginnt das zusammensetzen der Dateien mit ''ffmpeg''
-Download the source code for Untrunc from the github repo:+
  
-  wget https://github.com/ponchio/untrunc/archive/master.zip+  ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
  
-Unzip the source code: 
  
-  unzip master.zip 
  
-Go into the directory where it's been unzipped:+Audio, Musik, Ton aus einer Musik-Datei zu einem Video hinzufügen
  
-  cd untrunc-master+  ffmpeg -i ronnimachtsport01.mp4 -i music.m4a -map 0:v -map 1:a -c:v copy -shortest output_mit_musik.mp4
  
-Compile the source code using this command (all one line): 
  
-  g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil+==== Untrunc ====
  
-(you can try skipping this step and using the ready-provided executable, but it didn't work for me)+  * https://github.com/ponchio/untrunc
  
-Then you can actually fix the video. You need both the broken video and an example working video.+oder eine verbesserte Version:
  
-Ideally the video should be from the same camera & have the same resolution (mine was but it might work without). Also if it is at least as long as the broken one (preferably roughly the same) this may help.+  * https://github.com/anthwlock/untrunc
  
-Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files: 
  
-  ./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v+Es wir neben der defekten Videodatei noch eine funktionierende Datei welche vom gleichen Gerät erstellt worden ist wie die defekte.
  
-Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v+Zusätzlich werden noch benötigte Libraries mit ''apt'' oder ''zypper'' installiert:
  
-That's it you're done!+  sudo apt install libavformat-dev libavcodec-dev libavutil-dev
  
-VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.+Unter Suse benötigte ich noch das Paket //zlib-devel//
  
 +  zypper in zlib-devel
  
 +
 +Dann ''untrunc'' nach der README kompilieren und installieren.
 +
 +Die Verwendung von ''untrunc'' geschieht durch den Aufruf des Programms mit benötigten Optionen ''-s''  - step through unknown sequences und optional ''-v'' damit ausführliche Informationen ausgeben werden. Anschließend wird eine funktionierende Videodatei und die defekten Videodatei übergeben.
 +
 +
 +  ./untrunc -v -s ../../Videos/20150514_001.mp4 ../20150502_006_defekt.mp4
 +  
 +  
 ==== Screenshots von WebCam ==== ==== Screenshots von WebCam ====