Search code examples
ffmpegvideo-streamingvlcrtspip-camera

RTSP Feed Screen Cutoff


Recently I have been trying to consume the RTSP stream from a Vivitar Folding Drone. By reverse-engineering the .apk file for the Vivitar Folding Drone app, I was able to find that the RTSP address for the drone is rtsp://192.168.1.1:7070/webcam however, whenever I consume this stream through VLC or FFPLAY, most of the feed gets cut off and replaced with a green screen or gray screen (depends on whether I save to a .mjpeg file or a .dump file). What is the cause of this problem and what steps can I take to fix it?

enter image description here

When using FFPLAY, I use the following command:

ffplay -i -rtsp_flags rtsp://192.168.1.1:7070/webcam

I also receive this error when I first start consuming the stream with ffplay :

[swscaler @ 00000240daeadf80] deprecated pixel format used, make sure you did set range correctly

I receive this error message for about every frame of the stream:

[mjpeg @ 00000240d6226b00] mjpeg_decode_dc: bad vlc: 0:0 (00000240d6266050)
[mjpeg @ 00000240d6226b00] error dc
[mjpeg @ 00000240d6226b00] error y=1 x=0

NOTE: I am unsure if this is relevant, but the Vivitar Drone creates its own wifi network that must be signed onto if you want to consume the RTSP stream

Also, the drone feed works perfectly fine when viewed through the Vivitar Folding Drone app. I just can't seem to get it to display properly through FFPLAY, FFMPEG, or VLC.

UPDATE:

Upon further inspection, it seems like the Vivitar Folding Drone may not be sending all of the jpg data for a single frame. Here is an image generated by unaltered byte data sent through the RTSP feed. enter image description here

I noticed three things from this image:

  1. The image appears to be missing large chunks of data.
  2. The image appears to be redshifted
  3. The two visible portions of the image should be sequential (it looks as though the second visual portion lines up with the first). An example of this can be seen below.enter image description here

Solution

  • The issue was with the JPEG restart marker standard being broken by the Vivitar Software. A more detailed explanation and solution by cehoyo can be found here. I forked a version of the FFMPEG project and have applied the changes from cehoyo's solution on the FFMPEG forum in this Git fork.