wang-bin / QtAV

A cross-platform multimedia framework based on Qt and FFmpeg. 基于Qt和FFmpeg的跨平台高性能音视频播放框架. Recommand to use new sdk https://github.com/wang-bin/mdk-sdk
http://qtav.org
3.87k stars 1.48k forks source link

Problems playing RTP-streams (mjpeg, h264) #712

Open chindro opened 7 years ago

chindro commented 7 years ago

Hey,

I would like to play rtp-streams, mjpeg and h264 coded. I'm streaming from localhost using vlc. Receiving and playing with ffplay is working flawless. The error messages with mjpeg are:

"Decode video failed. undecoded: 2/2"
[FFmpeg:mjpeg] Found EOI before any SOF, ignoring
[FFmpeg:mjpeg] No JPEG data found in image
"[VideoDecoderFFmpegBase] Invalid data found when processing input"
...

The stream is playing anyway.

And with h264:

FFmpeg:sdp] RTP: missed 1080 packets
[FFmpeg:sdp] max delay reached. need to consume packet
[FFmpeg:sdp] RTP: missed 14 packets
[FFmpeg:sdp] max delay reached. need to consume packet
[FFmpeg:sdp] RTP: missed 3 packets

The stream is playing for one or two seconds, then these errors start to show up.

It may be a single or different issues, I don't know.

How to reproduce: VLC-Server: Media -> Stream -> add h.264-File -> Stream -> 3xnext -> paste the following strings into the textbox. for MJPEG (reencodes h264 to mjpeg): :sout=#transcode{vcodec=MJPG,vb=6000,acodec=none}:rtp{dst=127.0.0.1,port=5004} :sout-keep for h264 (just sends out): :sout=#transcode{acodec=none}:rtp{dst=127.0.0.1,port=5004} :sout-keep

on the player side I'm using the sdp-files as follows: mjpeg:

c=IN IP4 127.0.0.1
m=video 5004 RTP/AVP 26 
a=rtpmap:26 JPEG/90000

h264:

c=IN IP4 127.0.0.1
m=video 5004 RTP/AVP 96 
a=rtpmap:96 H264/90000

Code:

OpenGLWidgetRenderer* openGLrenderer = new OpenGLWidgetRenderer(this);
this->m_player = new AVPlayer(this);
this->m_vo = new VideoOutput(openGLrenderer->id(),this);
this->m_player->setRenderer(this->m_vo);
QVariantHash opt;
// probably since ffmpeg 3.x:
opt["protocol_whitelist"] = "file,udp,rtp";
this->m_player->setOptionsForFormat(opt);
this->setCentralWidget(this->m_vo->widget());
this->m_player->play("/home/devel/video_samples/test_mjpeg.sdp");

Playing the same file from disk is working fine with both QtAV and ffplay. I'm using QtAV edc59c87bcec46f03642becffa1026481edc5109 and ffmpeg 3.1.2 with Kubuntu 16.04.

Any ideas?

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

chindro commented 7 years ago

Could you please have a look at it? Do you need more information?