0

Hy!

There are a lot of articles around but I think I need a hint where to start. I have a sequence of rendered images which I created with Maya. I would now like to show a video using QT5.5 / C++.

Any ideas which options are around?

  • Converting the images to a video (e.g. ffmpeg)?
  • Creating a .GIF and using QVideo?
  • Using the QT Multimedia functionalities but with the images instead of a video?

Can anyone please share their experiences?

PatrickWe
  • 31
  • 1
  • 7
  • It depends on your final delivery platform. – durbnpoisn Sep 15 '15 at 18:47
  • Very broad question with lots of "correct" answers. But I would just convert the sequence to a video if that is how it's supposed to be shown. – Matt Runion Sep 15 '15 at 18:50
  • I am implementing a desktop application. Yes, converting it to a video is straightforward. I renderer an animation from three viewpoints, and I would like to switch between the animations (i.e. videos) in real-time. So I am wondering if I run into problems when loading the videos. Any of course, I need three videos for one animation (or even more) ... – PatrickWe Sep 15 '15 at 18:59
  • I already implemented a video player, but can't find goof tutorials about how to show the "video" using only the images... And links? – PatrickWe Sep 15 '15 at 19:00
  • Converting to video is the best to my mind. Loading of separate image would take more resources. GIF can use only 256 colors. – Alexander Sorokin Sep 15 '15 at 19:02
  • Ok, that's a good point. Does QT provide some Classes to convert images to a video? Otherwise I think ffmpeg is fine ... – PatrickWe Sep 15 '15 at 19:04
  • You wrote _I would like to switch between the animations (i.e. videos) in real-time._ Do you want to show render in real time? – Alexander Sorokin Sep 15 '15 at 19:06
  • Lets say I have an animation rendered from left and right - 2 images stacks with 100 images each. My plan is to create two videos. Now I would like to play the first video, and if the user pushes a button (frame 22), the second video should start (frame 23). etc ... – PatrickWe Sep 15 '15 at 19:13
  • First my idea is to create two instances of `QMediaPlayer` and open these video files using two players. When user wants to switch view just stop first player, call [`QMediaPlayer::setPosition()`](http://doc.qt.io/qt-5/qmediaplayer.html#position-prop) on second player and start it ([`QMediaPlayer::play()`](http://doc.qt.io/qt-5/qmediaplayer.html#play)). At the beginning open video files in player. I think it will work quick enough. – Alexander Sorokin Sep 15 '15 at 19:32
  • Ok that sounds good. Do you see any problem in using a "list" or array of such QMediaPlayer instances? One other idea I had is to use a simple QLabel and show the pixmap. Of cours with a delay between the frames. Anyway, video sounds good for me... – PatrickWe Sep 15 '15 at 19:55

1 Answers1

0

You can be keeping a certain number of images pre-loaded asynchronously, and asynchronously convert them to a screen-compatible image format and size. Then the main thread can blit them to the window - that should be pretty fast.

You don't need any video functionality for that. Only QtConcurrent::run to load and convert the images asynchronously, and a timer to show them in the main (gui) thread.

Kuba hasn't forgotten Monica
  • 95,931
  • 16
  • 151
  • 313