ffmpeg rtsp stream do ffserver

Brabec

ffmpeg rtsp stream do ffserver
« kdy: 10. 02. 2017, 15:15:12 »
Snazim se pomoci ffserver vytvorit mjpeg stream, ktery krmim rtsp streamem.

Pokud si vsak otevru mjpeg stream, dostavam snimky, ktere jsou ve sve spodni casti rozpadle.

FFserver:

Kód: [Vybrat]

Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 4
# max bandwidth per-client (kb/s)
MaxBandwidth 10000
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed webcam.ffm>
File /tmp/webcam.ffm
FileMaxSize 2205M
</Feed>



<Stream webcam.mjpeg>
Feed webcam.ffm
Format mpjpeg
VideoFrameRate 20
VideoBitRate 2048
VideoBufferSize 4096
VideoSize 640x480
VideoQMin 3
VideoQMax 31
NoAudio
Strict -1
</Stream>



ffmpeg:

Kód: [Vybrat]
ffmpeg    -i rtsp://view.localhost:7447/589c45_0   http://localhost:8090/webcam.ffm

Metadata:
    title           : 802AA84E4A45_0
    creation_time   : now
    encoder         : Lavf56.25.101
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480 [SAR 126:95 DAR 168:95], q=3-31, 2048 kb/s, 15 fps, 1000k tbn, 20 tbc
    Metadata:
      encoder         : Lavc56.26.100 mjpeg
Stream mapping:
  Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))



[h264 @ 0x88aa380] concealing 3421 DC, 3421 AC, 3421 MV errors in I frame
[h264 @ 0x871f600] Cannot use next picture in error concealment
[h264 @ 0x871f600] concealing 6063 DC, 6063 AC, 6063 MV errors in P frame
[h264 @ 0x8729240] cabac decode of qscale diff failed at 56 11
[h264 @ 0x8729240] error while decoding MB 56 11, bytestream 2430
[h264 @ 0x8729240] Cannot use next picture in error concealment
[h264 @ 0x8729240] concealing 6833 DC, 6833 AC, 6833 MV errors in P frame
[h264 @ 0x88aa380] concealing 3656 DC, 3656 AC, 3656 MV errors in I frame
[NULL @ 0x8735f20] RTP: missed 1 packetskB time=00:00:01.60 bitrate=2580.5kbits/s dup=15 drop=0
[NULL @ 0x8738c00] RTP: missed 258 packets
[h264 @ 0x88aa380] error while decoding MB 52 24, bytestream -7
[NULL @ 0x8738c00] RTP: missed 1 packets
[NULL @ 0x8738c00] RTP: missed 4 packets
[NULL @ 0x8738c00] RTP: missed 5 packets
[h264 @ 0x88aa380] concealing 5277 DC, 5277 AC, 5277 MV errors in I frame
[NULL @ 0x8738c00] RTP: missed 5 packets
    Last message repeated 1 times
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 5 packets
    Last message repeated 1 times
[NULL @ 0x8738c00] RTP: missed 2 packets
[NULL @ 0x8738c00] RTP: missed 3 packets
[NULL @ 0x8738c00] RTP: missed 5 packets
[h264 @ 0x871f600] left block unavailable for requested intra mode at 0 39
[h264 @ 0x871f600] error while decoding MB 0 39, bytestream 9943
[h264 @ 0x871f600] concealing 3529 DC, 3529 AC, 3529 MV errors in I frame
[h264 @ 0x8729240] Cannot use next picture in error concealment
[h264 @ 0x8729240] concealing 4889 DC, 4889 AC, 4889 MV errors in P frame
[NULL @ 0x8735f20] RTP: missed 2 packets
[NULL @ 0x8738c00] RTP: missed 3 packetskB time=00:00:04.25 bitrate=2274.5kbits/s dup=42 drop=0
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 5 packets
[NULL @ 0x8738c00] RTP: missed 4 packets
[NULL @ 0x8738c00] RTP: missed 3 packets
    Last message repeated 1 times
[NULL @ 0x8738c00] RTP: missed 5 packets
[NULL @ 0x8738c00] RTP: missed 4 packets
    Last message repeated 1 times
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 2 packets
[h264 @ 0x871f600] concealing 3964 DC, 3964 AC, 3964 MV errors in I frame
[NULL @ 0x8735f20] RTP: missed 1 packets
[NULL @ 0x8738c00] RTP: missed 3 packetskB time=00:00:05.35 bitrate=2260.1kbits/s dup=48 drop=0
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 5 packets
    Last message repeated 1 times
[NULL @ 0x8738c00] RTP: missed 4 packets
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 4 packets
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 4 packets
    Last message repeated 1 times
[h264 @ 0x871f600] concealing 4113 DC, 4113 AC, 4113 MV errors in I frame
[NULL @ 0x8738c00] RTP: missed 2 packetskB time=00:00:05.95 bitrate=2258.0kbits/s dup=51 drop=0
[NULL @ 0x8738c00] RTP: missed 5 packets
    Last message repeated 1 times
[NULL @ 0x8738c00] RTP: missed 6 packets
[NULL @ 0x8738c00] RTP: missed 5 packets



Pokud odkaz RTSP streamu otevru ve VLC, obraz je v poradku.



kapr

Re:ffmpeg rtsp stream do ffserver
« Odpověď #1 kdy: 10. 02. 2017, 17:19:48 »
Jestli dobre koukam tak tam mas nesrovnalosti ve fps, coz ti mozna dela problem, ze ti to nedorucuje ty pakety:


<Stream webcam.mjpeg>
VideoFrameRate 20

Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480 [SAR 126:95 DAR 168:95], q=3-31, 2048 kb/s, 15 fps, 1000k tbn, 20 tbc

Tady koukam trochu ulitava bitrate, protoze se to snazi neco dohonit asi:
[NULL @ 0x8735f20] RTP: missed 1 packetskB time=00:00:01.60 bitrate=2580.5kbits/s dup=15 drop=0
[NULL @ 0x8738c00] RTP: missed 258 packets

Obecne, kdyz ti nechodiej cely framy, tak je to vetsinou problem prenosu (mozna ti to nestiha linka, kamera tech veci muze bejt vic). Kdyby ti to nechodilo, zkus to dat na nejakejch 320x200 nebo minimum co to da a od toho bez nahoru. Dalsi bottleneck muzes mit ten server, jestli to to utahne cpu, protoze vidim, ze chces:

 Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))

misto h264 pouzij nejakej mpeg2, abys vedel, ze to upocitas pak si to zmen.