I want to stream endless live video data, e.g. from my webcam of my Ubuntu machine to an Android client. Therefore, I use ffmpeg (2.2.git) and ffserver (2.2.git) in order to encode with H.264, wrap into mp4 and, finally, stream via RTSP.
I succeed in streaming (send, receive and play) files, e.g. with ffmpeg being configured like that:
ffmpeg -re -i input.mp4 \
-pix_fmt yuv420p \
-c:v libx264 -profile:v baseline -level 3.0 \
-c copy http://127.0.0.1:8888/feed1.ffm
However, also with help of (1), (2), (3) and other articles, I do not arrive in successfully streaming 'endless' webcam data - let alone anything Android compatible. The idea is to use fragmented mp4.
When I try the following:
ffmpeg -re -f v4l2 -video_size 1280x720 -i /dev/video0 \
-pix_fmt yuv420p \
-c:v libx264 -profile:v baseline -level 3.0 \
-f mp4 -movflags frag_keyframe+empty_moov \
-c copy http://127.0.0.1:8888/feed1.ffm
ffmpeg shows errors:
[NULL @ 0x26b3ce0] [Eval @ 0x7fffa0738a20] Undefined constant or missing '(' in 'baseline'
[NULL @ 0x26b3ce0] Unable to parse option value "baseline"
[NULL @ 0x26b3ce0] Error setting option profile to value baseline.
[mp4 @ 0x26b2f20] Using AVStream.codec.time_base as a timebase hint to the muxer is deprecated. Set AVStream.time_base instead.
[mp4 @ 0x26b2f20] Could not find tag for codec rawvideo in stream #0, codec not currently supported in container
With the following slight differences:
ffmpeg \
-re -f v4l2 -i /dev/video0 \
-pix_fmt yuv420p \
-c:v libx264 \
-f mp4 -movflags frag_keyframe+empty_moov http://127.0.0.1:8888/feed2.ts
ffmpeg starts encoding but stops after ~2 seconds with the following output:
[libx264 @ 0x2549aa0] frame= 0 QP=23.20 NAL=3 Slice:I Poc:0 I:1200 P:0 SKIP:0 size=15471 bytes
It lets the shell crash.
I also tried multiple variants of the configurations above. V4l2 works fine. I assume that because I can record videos from my webcam, for example.
What do I have to do in order to stream webcam data?
EDIT: I use the combination of H.264, H.264's baseline profile and mp4 because I know about Android's compatibility. As I said, streaming works well when used with ordinary files.