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
wiki:video_repair [2020/10/24 21:13] – [Videos Encodieren] pulsarwiki:video_repair [2021/05/31 14:15] (aktuell) – gelöscht techguru
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 ===== 
- 
-The idea is to strip off the first 44 bytes of the header, for instance with a hex editor or using ''dd'' from ''CoreUtils'' and then to rebuild an ADTS stream from the stripped file using ''faad''. 
- 
-  dd ibs=1 skip=44 if='your broken file.m4a' of=raw.aac 
-  faad -a adts.aac raw.aac 
- 
- 
-==== mplayer mencoder ==== 
- 
-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 
- 
-   
-Springt zu 56. Sekunde 
- 
-  mencoder -ss 56 
- 
- 
-Verschiedene Optionen an ''mplayer'' übergeben um das defekte Video dennoch irgendwie abzuspielen. 
- 
-You can use the scale filer as an output option to tell ffmpeg to scale your images. This allows you 
-to keep the input images at their original size. Examples: 
- 
-<code> 
--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 
-the height automatically while keeping the aspect ratio. With your input size and the requested 1280 
-output width the height would end up being 828.  
- 
- 
-  mplayer -nosound -vf scale=1024:576 20150502_006.mp4 
-  mplayer -nosound -vo x11 -screenw 1920 -screenh 1088 20150502_006.mp4 
-   
-Forced video codec: ffh264vdpau 
-  mplayer -vo vdpau -vc ffh264vdpau 'So Live.avi' 
-   
-   
-==== ffmpeg ==== 
- 
-Das Video zu einer niedrigeren Auflösung encodieren. Oder mit ffmpeg zu einem anderen Format umwandeln: 
- 
-  ffmpeg -i "So Live.avi" -qscale 4 So_Live.mp4 
- 
-  ffmpeg -i "So Live.avi" -acodec copy -vcodec copy So_Live.avi 
-   
-Hiermit wird das Video richtig klein, indem die Framsize verkleiner wird. Von 40 MB auf 5 MB verkleinert. 
- 
-  ffmpeg -i The\ Run\ of\ the\ Golden\ Bull.webm -vf "scale=iw/2:ih/2" half_the_frame_size.mkv 
-   
-oder 
- 
-  ffmpeg -i input.mkv -vf "scale=iw/3:ih/3" a_third_the_frame_size.mkv 
-==== Untrunc ==== 
- 
-  * https://github.com/ponchio/untrunc 
-  * http://vcg.isti.cnr.it/~ponchio/untrunc.php 
- 
-It is possible to repair the broken mp4 or m4v file using Untrunc. For this method you need: 
- 
-another video file which isn't broken 
- 
-and Install some pre-requisite libraries with apt or zypper: 
- 
-  sudo apt install libavformat-dev libavcodec-dev libavutil-dev 
- 
-Unter Suse benötigte ich noch das Paket zlib-devel 
- 
-  zypper in zlib-devel 
- 
- 
-This is what to do: 
- 
-   
-Download the source code for Untrunc from the github repo: 
- 
-  wget https://github.com/ponchio/untrunc/archive/master.zip 
- 
-Unzip the source code: 
- 
-  unzip master.zip 
- 
-Go into the directory where it's been unzipped: 
- 
-  cd untrunc-master 
- 
-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 
- 
-(you can try skipping this step and using the ready-provided executable, but it didn't work for me) 
- 
-Then you can actually fix the video. You need both the broken video and an example working video. 
- 
-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. 
- 
-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 
- 
-Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v 
- 
-That's it you're done! 
- 
-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. 
- 
- 
-==== Screenshots von WebCam ==== 
- 
-=== MPlayer === 
- 
-To use MPlayer to take snapshots from your webcam run this command from the terminal: 
- 
-  mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 15 -vf screenshot 
- 
-From here you have to press s to take the snapshot. The snapshot will be saved in your current folder as shotXXXX.png. 
- 
-===== Video aufnehmen ===== 
- 
-If you want to record continuous video: 
- 
-  mencoder tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o filename.avi 
- 
-Press Ctrl+c to end the recording. 
- 
-Unter Debian, openSuse und weiteren zu finden 
-  guvcview             | GTK+ UVC Viewer and Capturer           | Paket  
- 
- 
-==== MPV ==== 
- 
-Unter Raspberry mit OSMC bietet sich das Programm ''mpv'' an, da ''mencoder'' nicht existiert. Außerdem sollte man beim Raspberry 1 ''avi'' als Dateiformat wählen, da ''mpv'' anhand der Endung automatisch den dazugehörigen Codec erkennt und ''avi'' am Performantesten läuft aber zwar miese Qualität bietet. Als Endung mp4, würde ein qualitative hohe Auflösung liefern aber sehr stark ruckeln. 
-  mpv av://video4linux2:/dev/video0 --o NameVideodatei.avi 
- 
- 
-=== Spezieller Raspberry Schalter in mpv === 
- 
-<code> 
---hwdec=<api> 
-              Specify the hardware video decoding API that should be used if possible.  Whether hardware decoding is actually done depends on the video codec. If hardware decoding is not possible, mpv will fall 
-              back on software decoding. 
- 
-              <api> can be one of the following: 
- 
-              no     always use software decoding (default) 
- 
-              auto   see below 
- 
-              vdpau  requires --vo=vdpau or --vo=opengl (Linux only) 
- 
-              vaapi  requires --vo=opengl or --vo=vaapi (Linux only) 
- 
-              vaapi-copy 
-                     copies video back into system RAM (Linux with Intel GPUs only) 
- 
-              videotoolbox 
-                     requires --vo=opengl (OS X 10.8 and up only) 
- 
-              dxva2-copy 
-                     copies video back to system RAM (Windows only) 
- 
-              rpi    requires --vo=rpi (Raspberry Pi only - default if available) 
- 
-              auto  tries to automatically enable hardware decoding using the first available method. This still depends what VO you are using. For example, if you are not using --vo=vdpau or --vo=opengl, vdpau 
-              decoding will never be enabled. Also note that if the first found method doesn't actually work, it will always fall back to software decoding, instead of trying the next method  (might  matter  on 
-              some Linux systems). 
-</code> 
- 
-==== VLC ==== 
- 
-VLC can also be used to view and record your webcam. In VLC's file menu, open the 'Capture Device...' dialog and enter the video and audio device files. Or from the command line, do: 
- 
-  vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" 
- 
-This will make VLC mirror your webcam. To take stills, simply choose 'Snapshot' in the 'Video' menu. To record the stream, you add a --sout argument, e.g. 
- 
-<code> 
-vlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" --sout "#transcode{vcodec=mp1v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mpeg1,dst=/tmp/test.mpg}}" 
-</code> 
- 
-Kein Ton, Optionen habe ich leicht geändert am 25.12.2018 
-<code> 
-cvlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/video0" --sout "#transcode{vcodec=h264,vb=1024,scale=1,acodec=mpga,ab=192,channels=2}:duplicate{dst=std{access=file,mux=mpeg1,dst=/tmp/test.mpg}}" 
-</code> 
- 
-Für Raspberry mit OSMC optimiert 
-  cvlc v4l:// :v4l-vdev="/dev/video0" :v4l-adev="/dev/audio2" --sout "#transcode{vcodec=mp4v,vb=1024,scale=1,acodec=mpga,ab=192,channels=2mux=mpeg1,dst=/tmp/test2.mpg}}" 
wiki/video_repair.1603566781.txt.gz · Zuletzt geändert: 2020/10/24 21:13 von pulsar