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.99k stars 1.51k forks source link

Buffering problem when playing video over a network #758

Open Xuno opened 8 years ago

Xuno commented 8 years ago

How should buffering work when playing remote media ? When player in buffering should the player stay in paused mode? and wake up is buffered is ready?

We detect that in some cases if the player is buffering the timeline continues to run and media is blank.

buffreing-qtav

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38831978-buffering-problem-when-playing-video-over-a-network?utm_campaign=plugin&utm_content=tracker%2F307703&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F307703&utm_medium=issues&utm_source=github).
wang-bin commented 8 years ago

It should be paused. The buffering progress is video's progress. Audio plays because audio queue is fully buffered when video is buffering. It's wrong and video will far behind audio. I will fix it.

Xuno commented 8 years ago

We are testing 10 bit HEVC video only (no audio stream) and have black screen/playback termination. The same videos play OK in both VLC and a custom version of Chromium with HEVC support.

This problem occurs with playback over a network and from local storage.

Xuno commented 8 years ago

Please see issue #773

wang-bin commented 8 years ago

I need your log.

Xuno commented 8 years ago

Debug: vo: Debug\bin\Player Debug: QtAV 1.11.0(Nov 29 2016, 20:46:20) Multimedia framework base on Qt and FFmpeg. Distributed under the terms of LGPLv2.1 or later. Shanghai University->S3 Graphics->Deepin, Shanghai, ChinaCopyright (C) 2012-2016 Wang Bin (aka. Lucas Wang) wbsecg1@gmail.com Donate: http://qtav.org/donate.html Source: https://github.com/wang-bin/QtAV Home page: http://qtav.org Debug: "Build with Qt-5.7.0" Debug: "FFmpeg/Libav configuration: --extra-version=QtAV --disable-doc --disable-debug --enable-shared --disable-static --enable-runtime-cpudetect --enable-hwaccels --enable-avresample --disable-postproc --disable-iconv --enable-pic --extra-ldflags=' -static-libgcc -Wl,-Bstatic' --enable-small" Debug: "Build with avutil-55.28.100" Debug: "Build with avcodec-57.48.101" Debug: "Build with avformat-57.41.100" Debug: "Build with avfilter-6.47.100" Debug: "Build with avdevice-57.0.101" Debug: "Build with avresample-3.0.0" Debug: "Build with swresample-2.1.100" Debug: "Build with swscale-4.1.100" Debug: engine: "LibASS" Debug: engine: "FFmpeg" Debug: engine: "FFmpeg" Warning: "can not load cuda!" Debug: Registered audio backends: ("XAudio2", "OpenAL", "DirectSound", "null") Debug: "XAudio2_9" Debug: "Build with XAudio2 from Win8 or later SDK" Debug: "Try symbol 'XAudio2Create' from WinSDK dll" Debug: "xaudio2: 0x21086510090" Debug: "OpenGL version: 2.0 hasGLSL: 1" Debug: "GL_VERSION: OpenGL ES 2.0 (ANGLE 2.1.0.8613f4946861)" Debug: "GL_VENDOR: Google Inc." Debug: "GL_RENDERER: ANGLE (AMD Radeon R9 200 Series Direct3D9Ex vs_3_0 ps_3_0)" Debug: "GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL ES 1.00 (ANGLE 2.1.0.8613f4946861)" Debug: "Is OpenGLES: 1" Debug: "Is EGL: 1" Debug: "GLSL version: 100" Debug: "Has PBO: 0" Debug: "check gl3 rg: 0x822B" Debug: "check es3 rg: 0x822B" Debug: "check GL_EXT_texture_rg" Debug: "check gl es>=3 rg" Debug: "fallback to gl_param_compat" Debug: "Has 16bit texture: 0" Debug: "Has RG texture: 0" Debug: QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize 5, greenBufferSize 6, blueBufferSize 5, alphaBufferSize 0, stencilBufferSize 8, samples 0, swapBehavior 0, swapInterval -1, profile 0) Debug: "Not playing~" Debug: QHash(("probesize", QVariant(uint, 5000000))("analyzeduration", QVariant(int, 5000000))) Debug: Loading QVariant(QString, "http://www.xuno.com/content/RED_Epic_Dragon_6K_96fps_Girls/main/RED_Epic_Dragon_6K_96fps_Girls_480x270_yuv444p10le.mp4") ... Debug: "all closed and reseted" Debug: "avformat_open_input: d->format_ctx:'0x210863858e0', url:'http://www.xuno.com/content/RED_Epic_Dragon_6K_96fps_Girls/main/RED_Epic_Dragon_6K_96fps_Girls_480x270_yuv444p10le.mp4'..." Debug: "avformat_open_input: url:'http://www.xuno.com/content/RED_Epic_Dragon_6K_96fps_Girls/main/RED_Epic_Dragon_6K_96fps_Girls_480x270_yuv444p10le.mp4' ret:0" Debug: Debug: "avfmtctx.flags: 513, iformat.flags" Debug: Debug: "avfmtctx.flags: 513, iformat.flags" status changed "Loaded" status changed "Loaded" Warning: "invalid index 0 (valid is 0~0) for stream type 2." Debug: "notify_interval: 250" Debug: "stream: 1, duration=1018352 (23091 ms), time_base=0.000023" Debug: "codec: aac()" Debug: "stream: 0, duration=445600 (23227 ms), time_base=0.000052" Debug: "codec: hevc()" Debug: "get av queue a/v thread = 0x21084133da0 0x21084135840" Warning: "no frame could be decompressed: Error number 4616 occurred 0/4616" Warning: "[AudioDecoder] got_frame_ptr=false. decoded: 31, un: 0" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "[AudioDecoder] got_frame_ptr=false. decoded: 466, un: 0" Debug: "buffersrc_args=time_base=1/1000000:sample_rate=44100:sample_fmt=fltp:channel_layout=0x3" Warning: "no frame could be decompressed: Error number 5965 occurred 0/5965" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 2075 occurred 0/2075" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: [FFmpeg:?] No such filter: '' Warning: [FFmpeg:?] Error avfilter_graph_parse_ptr(filter_graph, options.toUtf8().constData(), &inputs, &outputs, 0) @160 C:\Users\lex\MyDocuments\C_Projects\GitHub\QtAV\src\filter\LibAVFilter.cpp: (0xffffffea) Invalid argument Warning: "setup audio filter graph error" Debug: "swr speed=1.00" Debug: "out: {cl: 3, fmt: flt, freq: 44100}" Debug: "in {cl: 3, fmt: fltp, freq: 44100}" Warning: "no frame could be decompressed: Error number 1257 occurred 0/1257" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 1054 occurred 0/1054" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 5677 occurred 0/5677" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 2145 occurred 0/2145" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 949 occurred 0/949" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 1033 occurred 0/1033" Warning: "invalid video frame from decoder. undecoded data size: 0" Warning: "no frame could be decompressed: Error number 7432 occurred 0/7432" Warning: "invalid video frame from decoder. undecoded data size: 0" Debug: "buffersrc_args=video_size=480x270:pix_fmt=78:time_base=1/1000000:pixel_aspect=1/1" Warning: [FFmpeg:?] No such filter: '' Warning: [FFmpeg:?] Error avfilter_graph_parse_ptr(filter_graph, options.toUtf8().constData(), &inputs, &outputs, 0) @160 C:\Users\lex\MyDocuments\C_Projects\GitHub\QtAV\src\filter\LibAVFilter.cpp: (0xffffffea) Invalid argument Warning: "setup video filter graph error" Debug: "QtAV::VideoRenderer::setInSize => calculating aspect ratio from converted input data(1.777778)" Debug: "delay -0.518102s @1.080s pts:1.168" Debug: "delay -0.504893s @1.080s pts:1.084" Debug: "delay -0.851476s @1.846s pts:1.710" Debug: "frame slow count: 1. v-a: -0.896" Debug: "delay -0.895521s @1.846s pts:1.626" Debug: "delay -0.875693s @1.846s pts:1.585" Debug: "delay -0.843992s @1.846s pts:1.668" Debug: "delay -0.812290s @1.846s pts:1.877" Debug: "delay -0.780589s @1.846s pts:1.793" Debug: "delay -0.748887s @1.846s pts:1.751" Debug: "delay -0.717186s @1.846s pts:1.835" Debug: "delay -0.685484s @1.846s pts:2.043" Debug: "delay -0.665173s @1.857s pts:1.960" Debug: "delay -0.633472s @1.857s pts:1.918" Debug: "delay -0.601770s @1.857s pts:2.002" Debug: "frame slow count: 2. v-a: -0.686" Debug: "delay -0.686069s @1.973s pts:2.210" Debug: "frame slow count: 3. v-a: -0.701" Debug: "delay -0.701367s @2.043s pts:2.127" Debug: "frame slow count: 4. v-a: -0.721" Debug: "delay -0.721471s @2.072s pts:2.085" Debug: "delay -0.689770s @2.072s pts:2.168" Debug: "delay -0.658068s @2.072s pts:2.377" Debug: "delay -0.626367s @2.072s pts:2.294" Debug: "delay -0.594665s @2.072s pts:2.252" Debug: "delay -0.562964s @2.072s pts:2.335" Debug: "delay -0.531262s @2.072s pts:2.544" Debug: "delay -0.766262s @2.473s pts:2.711" Debug: "delay -0.734560s @2.473s pts:2.627" Debug: "delay -0.702859s @2.473s pts:2.585" Debug: "delay -0.671158s @2.473s pts:2.669" Debug: "delay -0.639456s @2.473s pts:2.877" Debug: "delay -0.607755s @2.473s pts:2.794" Debug: "delay -0.567053s @2.473s pts:2.752" Debug: "delay -0.526352s @2.473s pts:2.836" Debug: "End of file. erreof=1 feof=0" Debug: "audio is too short than video: 0.157, fake_apkt.duration: 1.161" Debug: "video thread gets an eof packet." Debug: "(repeat 3)video thread gets an eof packet.\naudio thread gets an eof packet. pkt.pts: -1.000, d.render_pts0:-1.000" Warning: "[AudioDecoder] got_frame_ptr=false. decoded: 0, un: 3" Warning: "Decode audio failed. undecoded: 3" Debug: "audio decode eof done" Debug: "waiting audio thread......." Debug: "video thread gets an eof packet." Debug: "audio thread gets an eof packet. pkt.pts: -1.000, d.render_pts0:-1.000" Warning: "[AudioDecoder] got_frame_ptr=false. decoded: 0, un: 3" Warning: "Decode audio failed. undecoded: 3" Debug: "audio decode eof done" Debug: "Audio thread stops running..." Debug: "waiting video thread......." Debug: "video thread gets an eof packet." Warning: "(repeat 5)video thread gets an eof packet.\nno frame could be decompressed: Error number 0 occurred 3/3" Warning: "Decode video failed. undecoded: 3/3" Debug: "video decode eof done. d.render_pts0: -1.000" Debug: "video thread gets an eof packet." Debug: "**trying video decoder: FFmpeg..." Debug: "set QtAV::VideoDecoderFFmpeg() meta properties:" Debug: "skip_idct=>0" Debug: "thread_type=>3" Debug: "skip_loop_filter=>0" Debug: "codecName=>" Debug: "skip_frame=>0" Debug: "hwaccel=>" Debug: "vismv=>0" Debug: "threads=>0" Debug: "QtAV::VideoDecoderFFmpeg thread type: Frame, count: 9" Debug: "**Video decoder found:0x21084136b00" Debug: "**set new decoder:0x21084135360 -> 0x21084136b00" Debug: "Video decoder does not change" Warning: "Can not copy codec properties when it's open" Warning: "no frame could be decompressed: Error number 0 occurred 3/3" Warning: "Decode video failed. undecoded: 3/3" Debug: "video decode eof done. d.render_pts0: -1.000" Debug: "Video thread stops running..." Debug: "QtAV::VideoRenderer::setInSize => calculating aspect ratio from converted input data(0.000000)" Debug: "Demux thread stops running...." Debug: "demuxer thread emit finished. repeat: 0/0" Debug: "avplayer emit stopped()" Warning: "Can not copy codec properties when it's open" Debug: "(repeat 1)Can not copy codec properties when it's open\nclosing d->format_ctx"

Xuno commented 8 years ago

Is the latest ffmpeg code used?

wang-bin commented 8 years ago

From your log i see no picture is rendered. The latest ffmpeg is here: https://sourceforge.net/projects/qtav/files/depends/FFmpeg/windows/ffmpeg-3.2.1-windows-x86%2Bx64.7z/download

wang-bin commented 8 years ago

I can play your url correctly

Xuno commented 8 years ago

We updated our custom repeat filter for earlier versions of QtAV which fixed our playback problem. When playing a sequence of videos the time stamp of the last frame of the previous video wasn't being flushed properly with repeat disabled. All OK now.