Dies ist eine alte Version des Dokuments!
Inhaltsverzeichnis
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.
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
Untrunc
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
a linux installation (I used Ubuntu 12.04) and basic ability to use a command line.
This is what to do:
Install some pre-requisite libraries with this command:
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev
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
--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).
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.
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}}"
Kein Ton, Optionen habe ich leicht geändert am 25.12.2018
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}}"
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}}"