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

seek导致画面不动 #1199

Open gasry1989 opened 5 years ago

gasry1989 commented 5 years ago

QtAV, Qt version and platform

QtAV 1.12.0(Apr 17 2019, 11:39:33) 基于ubuntu 18.04 64bit 下的QT4.8.7

Reproduction steps

1.new QtAV::VideoOutput对象,在主窗体中将其widget设置为全屏move(0,0), fixedsize(1920,1080) 2.在主窗体上添加其他的控件,播放和暂停,以达到悬浮在视频显示区域上层 3.播放后seek操作,大概率会导致画面停止,或者卡顿很久 4.视频文件tmp.avi用example中的player和simplePlayer是正常seek操作的 不知道和videoOutput的widget置于底层是否有关?? 具体代码和日志请看下方

Expected behavior

正常的seek,play和pause

Actual behavior

seek之后,画面不动了,但是状态isPaused是false,isPlaying是true

Log file

avformat_open_input: url:'/var/video/tmp.avi' ret:0 [FFmpeg:mpeg4] Failed to parse extradata avfmtctx.flags: 2097153, iformat.flags invalid index 0 (valid is 0~0) for stream type 2. notify_interval: 500 stream: 0, duration=46285 (1542833 ms), time_base=0.033333 codec: mpeg4(MPEG-4 part 2) invalid index 0 (valid is 0~0) for stream type 0. **trying video decoder: FFmpeg... QtAV::VideoDecoderFFmpeg thread type: Single, count: 1 **Video decoder found:0x5639140477f0 setCapture 0x5639145b1880 stream: 0, duration=46285 (1542833 ms), time_base=0.033333 codec: mpeg4(MPEG-4 part 2) auto select clock: audio > external No audio found or audio not supported. Using ExternalClock. Clock initial value: 0.000000 Starting video thread... get av queue a/v thread = 0x0 0x5639147938e0 setInSize => calculating aspect ratio from converted input data(1.777778) (repeat 1)setInSize => calculating aspect ratio from converted input data(1.777778) AVClock started!!!!!!!! int CameraStreamSource::Connect() 168 Login camera failed ! seek to 00:23:38 1418166 ms (91.919605%) demuxer sync id: 1/1 External clock change: 0.377000 ==> 1418.166000 [FFmpeg:NULL] Failed to parse extradata delay -1417.036667s @1418.170s pts:1.133 request seek video thread Invalid packet! flush video codec context!!!!!!!!!! video packet queue size: 21 video seek: 1418.166, id: 1 video thread wait to sync end for sync id: 1 (repeat 4)video thread wait to sync end for sync id: 1 seeking... pkt.pts - d.render_pts0: -0.033 video thread wait to sync end for sync id: 1 seeking... pkt.pts - d.render_pts0: 0.001 video seek finished @1418.166000. id: 1 seek to 00:22:43 1363285 ms (88.362448%) demuxer sync id: 2/2 External clock change: 1421.302990 ==> 1363.285000 [FFmpeg:NULL] Failed to parse extradata

Sample files (optional)

videoOutput = new QtAV::VideoOutput(this); if (!videoOutput->widget()) { QMessageBox::warning(0, QString::fromLatin1("QtAV error"), tr("Can not create video renderer")); return; } avPlayer->setRenderer(videoOutput); videoOutput->widget()->move(0,0); videoOutput->widget()->setFixedSize(1920,1080); layout()->addWidget(videoOutput->widget());

slider = ui->posSlider;
slider->setOrientation(Qt::Horizontal);

connect(avPlayer, SIGNAL(positionChanged(qint64)), this,SLOT(updateSlider(qint64)));
connect(avPlayer, SIGNAL(started()),this, SLOT(playerStarted()));

connect(avPlayer, SIGNAL(stateChanged(QtAV::AVPlayer::State)), this,SLOT(playerStateChanged(QtAV::AVPlayer::State  )));

connect(avPlayer, SIGNAL(error(QtAV::AVError)), this, SLOT(playerError(QtAV::AVError)));
connect(avPlayer, SIGNAL(stopped()), this, SLOT(playerStopped()));
connect(avPlayer, SIGNAL(paused(bool)), this, SLOT(playerPaused(bool)));

// avPlayer->setSeekType(QtAV::SeekType::KeyFrameSeek);

//    ui->topFrame->hide();
ui->statusImageLabel->hide();
ui->statusTextLabel->hide();
videoOutput->widget()->lower();
videoOutput->widget()->setFocus();
hzh-1148 commented 6 months ago

hello,这个问题最后你是怎么解决的,我也遇到类似的情况了

wang-bin commented 6 months ago

此项目不维护,请使用新的库 https://github.com/wang-bin/mdk-sdk

hzh-1148 commented 5 months ago

此项目不维护,请使用新的库 https://github.com/wang-bin/mdk-sdk

你好,我想知道这种情况属于QtAv的bug还是我某些地方使用错误,谢谢

wang-bin commented 5 months ago

我也没法回答,很久没看代码了,你得自己分析