Answer the question
In order to leave comments, you need to log in
How to write video from /dev/video0 to file on Raspberry PI 2?
Good afternoon!
To record video on the computer to a file, I have always used ffmpeg and everything worked. But when I did the same on raspberries, it turned out strange.
I do:
ffmpeg -i /dev/video0 -vcodec libx264 file_name.mp4
ffmpeg version N-79679-g6f784c1 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.2 (Raspbian 4.9.2-10)
configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --bindir=/home/pi/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 55. 22.101 / 55. 22.101
libavcodec 57. 38.100 / 57. 38.100
libavformat 57. 34.103 / 57. 34.103
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 44.100 / 6. 44.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 0.101 / 2. 0.101
libpostproc 54. 0.100 / 54. 0.100
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 287.562118, bitrate: 165722 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 720x480, 165722 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1ce6320] using cpu capabilities: ARMv6 NEON
[libx264 @ 0x1ce6320] profile High 4:2:2, level 3.0, 4:2:2 8-bit
[libx264 @ 0x1ce6320] 264 - core 148 r2694 3b70645 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x1ce4ea0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, mp4, to 'out.mp4':
Metadata:
encoder : Lavf57.34.103
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv422p, 720x480, q=2-31, 29.97 fps, 30k tbn
Metadata:
encoder : Lavc57.38.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
Last message repeated 1 times
frame= 18 fps=0.0 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=2 drop=0 speed= 0x
frame= 33 fps= 33 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=2 drop=0 speed= 0x
frame= 47 fps= 16 q=0.0 size= 0kB time=00:00:00.00 bitrate=N/A dup=2 drop=0 speed= 0x
frame= 54 fps= 16 q=29.0 size= 11kB time=00:00:00.03 bitrate=2589.5kbits/s dup=2 drop=0 speed=0.00966x
frame= 61 fps= 15 q=29.0 size= 14kB time=00:00:00.26 bitrate= 440.1kbits/s dup=2 drop=0 speed=0.0665x
frame= 68 fps= 15 q=29.0 size= 18kB time=00:00:00.50 bitrate= 293.9kbits/s dup=2 drop=0 speed=0.11x
frame= 74 fps= 15 q=29.0 size= 21kB time=00:00:00.70 bitrate= 248.8kbits/s dup=2 drop=0 speed=0.138x
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
frame= 78 fps= 14 q=29.0 size= 24kB time=00:00:00.83 bitrate= 238.6kbits/s dup=2 drop=0 speed=0.149x
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
Last message repeated 3 times
frame= 95 fps= 14 q=29.0 size= 32kB time=00:00:01.40 bitrate= 186.8kbits/s dup=18 drop=0 speed=0.204x
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
Last message repeated 7 times
frame= 121 fps= 14 q=29.0 size= 46kB time=00:00:02.26 bitrate= 165.3kbits/s dup=43 drop=0 speed=0.256x
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
Last message repeated 19 times
frame= 174 fps= 14 q=29.0 size= 60kB time=00:00:04.03 bitrate= 122.2kbits/s dup=95 drop=0 speed=0.33x
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
Last message repeated 32 times
frame= 371 fps= 16 q=29.0 size= 88kB time=00:00:10.61 bitrate= 67.6kbits/s dup=291 drop=0 speed=0.467x
[video4linux2,v4l2 @ 0x1ce31e0] Dequeued v4l2 buffer contains corrupted data (691200 bytes).
Last message repeated 27 times
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question