Discussion:
[FFmpeg-user] ffmpeg/ffserver h264 webcam streaming
Ricardo Mota
2014-10-27 20:52:13 UTC
Permalink
I'm trying to setup a h264 streaming from my webcam to the web using the
following configuration file for ffserver.


- ffserver.conf <http://pastebin.com/ig74S0Zq>


When I feed ffserver with *fmpeg -f v4l2 -input_format rawvideo
-pixel_format yuyv422 -framerate 10 -video_size 1280x720 -i /dev/video0
http://localhost:8090/feed1.ffm <http://localhost:8090/feed1.ffm>*, i get
the following output:


- ffmpeg output <http://pastebin.com/eE7EqQ24>


But when I try to play the stream with *ffplay *for example, I get the
following error:

*[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9d680008c0] Format mov,mp4,m4a,3gp,3g2,mj2
detected only with low score of 1, misdetection possible!*
*[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f9d680008c0] moov atom not found*
*http://localhost:8090/test.mp4 <http://localhost:8090/test.mp4>: Invalid
data found when processing input*


Could you guys please help me on this?

Thank you for your attention.
--
Ricardo Frederico Leote Mota
Moritz Barsnick
2014-10-28 11:02:17 UTC
Permalink
Post by Ricardo Mota
I'm trying to setup a h264 streaming from my webcam to the web using the
following configuration file for ffserver.
- ffserver.conf <http://pastebin.com/ig74S0Zq>
For reference, here is one relevant part:

<Stream test.mp4> # Output stream URL definition
Feed feed1.ffm # Feed from which to receive video
Format mp4

# Audio settings
NoAudio

VideoCodec libx264
VideoSize 1280x720
VideoFrameRate 25
AVOptionVideo flags +global_header
AVOptionVideo cpu-used 0
AVOptionVideo qmin 10
AVOptionVideo qmax 42
AVOptionVideo quality good
AVOptionVideo me_range 16
AVOptionVideo qdiff 4
AVOptionAudio flags +global_header
PreRoll 15
StartSendOnKey
VideoBitRate 1M
</Stream>
Post by Ricardo Mota
detected only with low score of 1, misdetection possible!*
*http://localhost:8090/test.mp4 <http://localhost:8090/test.mp4>: Invalid
data found when processing input*
It seems this is an FAQ. Most answers hint that mp4 is not a suitable
format, despite "flags +global_header".

If you replace the above config with flv:
<Stream test.flv>
Feed feed1.ffm
Format flv
[...]

and access the appropriate URL with ffplay
(http://localhost:8090/test.flv), it works fine (for me).

Moritz
Ricardo Mota
2014-10-28 12:00:46 UTC
Permalink
Thank you for your help Moritz, I tried your suggestion and I can say it
works.

I'm now trying to implement the same thing but using webm streaming, with
the same configuration, just replacing the format and VideoCodec:

*<Stream test.webm> # Output stream URL definition*
* Feed feed1.ffm # Feed from which to receive video*
* Format webm*

* # Audio settings*
* NoAudio *

* VideoCodec libvpx*
* VideoSize 1280x720 *
* VideoFrameRate 25 *
* AVOptionVideo flags +global_header *
* AVOptionVideo cpu-used 0*
* AVOptionVideo qmin 10*
* AVOptionVideo qmax 42*
* AVOptionVideo quality good*
* AVOptionVideo me_range 16*
* AVOptionVideo qdiff 4*
* AVOptionAudio flags +global_header*
* PreRoll 15*
* StartSendOnKey*
* VideoBitRate 1M*
*</Stream>*

but when i try to run it with *ffmpeg -f v4l2 -input_format rawvideo
-pixel_format yuyv422 -framerate 25 -video_size 1280x720 -i /dev/video0
http://localhost:8090/feed1.ffm <http://localhost:8090/feed1.ffm>*, i get
the following error:


- http://pastebin.com/Z0ePhx3N
Post by Moritz Barsnick
Post by Ricardo Mota
I'm trying to setup a h264 streaming from my webcam to the web using the
following configuration file for ffserver.
- ffserver.conf <http://pastebin.com/ig74S0Zq>
<Stream test.mp4> # Output stream URL definition
Feed feed1.ffm # Feed from which to receive video
Format mp4
# Audio settings
NoAudio
VideoCodec libx264
VideoSize 1280x720
VideoFrameRate 25
AVOptionVideo flags +global_header
AVOptionVideo cpu-used 0
AVOptionVideo qmin 10
AVOptionVideo qmax 42
AVOptionVideo quality good
AVOptionVideo me_range 16
AVOptionVideo qdiff 4
AVOptionAudio flags +global_header
PreRoll 15
StartSendOnKey
VideoBitRate 1M
</Stream>
mov,mp4,m4a,3gp,3g2,mj2
Post by Ricardo Mota
detected only with low score of 1, misdetection possible!*
Invalid
Post by Ricardo Mota
data found when processing input*
It seems this is an FAQ. Most answers hint that mp4 is not a suitable
format, despite "flags +global_header".
<Stream test.flv>
Feed feed1.ffm
Format flv
[...]
and access the appropriate URL with ffplay
(http://localhost:8090/test.flv), it works fine (for me).
Moritz
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
--
Ricardo Frederico Leote Mota

<http://www.fct.unl.pt/>
Mestrado Integrado em Engenharia Electrotécnica e de Computadores - Nº 25154

<http://artica.cc/>
*http://artica.cc <http://artica.cc/>* *faceboo**k*
<https://www.facebook.com/pages/ArticaCc/196701617031031?ref=br_tf> *blog
<http://artica.cc/blog/>* *youtube <https://www.youtube.com/user/articacc>*
Embedded, Robotics and Control Systems Engineer @ Artica CC

We transform emerging technologies and art into *meaningful* human
experiences.
Artica digs electronics, education, robots, digital fabrication,
prototyping, and all things creative.

E-Mail : ***@gmail.com
Phone : (+351) 92 442 19 71
Skype : rfl.mota

<http://www.facebook.com/ricardoflmota>
<https://plus.google.com/106404227708624298408/posts>
Moritz Barsnick
2014-10-28 12:28:47 UTC
Permalink
Post by Ricardo Mota
- http://pastebin.com/Z0ePhx3N
Please always post logs to the list!
Post by Ricardo Mota
but when i try to run it with *ffmpeg -f v4l2 -input_format rawvideo
-pixel_format yuyv422 -framerate 25 -video_size 1280x720 -i /dev/video0
http://localhost:8090/feed1.ffm <http://localhost:8090/feed1.ffm>*, i get
You're probably not encoding to webm. You need to add something like
-c:v libvpx
to your ffmpeg command line. But I'm just guessing, I can't test since
I don't have libvpx.

Moritz
Ricardo Mota
2014-10-28 12:32:15 UTC
Permalink
But should't ffserver configuration file provide the encoding options,
namely *VideoCodec *libvpx?

With ffmpeg command I'm just feeding the raw video stream...
Post by Moritz Barsnick
Post by Ricardo Mota
- http://pastebin.com/Z0ePhx3N
Please always post logs to the list!
Post by Ricardo Mota
but when i try to run it with *ffmpeg -f v4l2 -input_format rawvideo
-pixel_format yuyv422 -framerate 25 -video_size 1280x720 -i /dev/video0
http://localhost:8090/feed1.ffm <http://localhost:8090/feed1.ffm>*, i
get
You're probably not encoding to webm. You need to add something like
-c:v libvpx
to your ffmpeg command line. But I'm just guessing, I can't test since
I don't have libvpx.
Moritz
_______________________________________________
ffmpeg-user mailing list
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
--
Ricardo Frederico Leote Mota

<http://www.fct.unl.pt/>
Mestrado Integrado em Engenharia Electrotécnica e de Computadores - Nº 25154

<http://artica.cc/>
*http://artica.cc <http://artica.cc/>* *faceboo**k*
<https://www.facebook.com/pages/ArticaCc/196701617031031?ref=br_tf> *blog
<http://artica.cc/blog/>* *youtube <https://www.youtube.com/user/articacc>*
Embedded, Robotics and Control Systems Engineer @ Artica CC

We transform emerging technologies and art into *meaningful* human
experiences.
Artica digs electronics, education, robots, digital fabrication,
prototyping, and all things creative.

E-Mail : ***@gmail.com
Phone : (+351) 92 442 19 71
Skype : rfl.mota

<http://www.facebook.com/ricardoflmota>
<https://plus.google.com/106404227708624298408/posts>
Loading...