[FFmpeg-trac] #2882(undetermined:open): ffmpeg can't save h264 stream from v4l2 webcam into file without recoding
FFmpeg
trac at avcodec.org
Thu Aug 22 04:50:36 CEST 2013
#2882: ffmpeg can't save h264 stream from v4l2 webcam into file without recoding
-------------------------------------+-------------------------------------
Reporter: pchel | Owner:
Type: defect | Status: open
Priority: normal | Component:
Version: git-master | undetermined
Keywords: v4l2 h264 | Resolution:
Blocking: | Blocked By:
Analyzed by developer: 0 | Reproduced by developer: 0
-------------------------------------+-------------------------------------
Comment (by pchel):
Replying to [comment:10 xlinkz0]:
> Does the webcam specification say that it can stream yuvj420p ?
I can't find the webcam specification, but I'm pretty sure it supports
Proofs
{{{
v4l2-ctl -i /dev/video0 --list-formats
Video input set to 0 (Camera 1: ok)
ioctl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUV 4:2:2 (YUYV)
Index : 1
Type : Video Capture
Pixel Format: 'H264' (compressed)
Name : H.264
Index : 2
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : MJPEG
}}}
ffmpeg works just fine with yuvj420p and recoding
> As far as I understand you are setting the option on the input. I do not
think you can just request a different stream like that from a device.
Don't understand that. I can request YUYV (5 frames per second), MJPEG (5
frames per second if I'm right) and H264 (30 frames per second). I chose
H264 because it gives me 30 fps from me webcam
> You modified the simple command I gave you, does the simple command
work?
It doesn't. See below:
{{{
➜ ffmpeg git:(master) ✗ ./ffmpeg -report -y -i /dev/video0 -t 10 -c copy
out.mkv
ffmpeg started on 2013-08-21 at 19:38:47
Report written to "ffmpeg-20130821-193847.log"
ffmpeg version N-55607-g2c1a215 Copyright (c) 2000-2013 the FFmpeg
developers
built on Aug 18 2013 10:35:18 with gcc 4.7 (Ubuntu/Linaro
4.7.2-2ubuntu1)
configuration: --enable-indev=alsa
libavutil 52. 42.100 / 52. 42.100
libavcodec 55. 28.100 / 55. 28.100
libavformat 55. 13.103 / 55. 13.103
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 82.100 / 3. 82.100
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
/dev/video0: Invalid argument
}}}
> Are you only dissatisfied that it is not the proper format?
The camera supports hardware h.264 encoding. I want to use this hardware
capability.
> If so you might want to reconsider transcoding it on the fly with a fast
x264 preset that will work in real time for most mid-range processors.
I've already have fast recoding from h.264 from camera into mp4 with
command line
{{{
ffmpeg -f alsa -ac 2 -i plughw:CARD=C920,DEV=0 -acodec aac -vcodec h264 -f
v4l2 -i /dev/video0 -q 0 -vcodec mpeg4 -y -strict -2 out.mp4
}}}
> Unless you can prove that you can receive in any other way a yuvj420p
directly from the webcam without any software transcoding try :
>
> {{{
> ffmpeg -y -i /dev/video0 -f v4l2 -c:v libx264 -preset superfast out.mkv
> }}}
It doesn't work again:
{{{
➜ ffmpeg git:(master) ✗ ./ffmpeg -y -i /dev/video0 -f v4l2 -c:v libx264
-preset superfast out.mkv
ffmpeg version N-55607-g2c1a215 Copyright (c) 2000-2013 the FFmpeg
developers
built on Aug 18 2013 10:35:18 with gcc 4.7 (Ubuntu/Linaro
4.7.2-2ubuntu1)
configuration: --enable-indev=alsa
libavutil 52. 42.100 / 52. 42.100
libavcodec 55. 28.100 / 55. 28.100
libavformat 55. 13.103 / 55. 13.103
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 82.100 / 3. 82.100
libswscale 2. 5.100 / 2. 5.100
libswresample 0. 17.103 / 0. 17.103
Unrecognized option 'preset'.
Error splitting the argument list: Option not found
}}}
I suspect you need to put '-i' option between input and output params.
In any case, thank you for your try to help me.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2882#comment:14>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list