0

This is very straight forward question. I'm generating a video using moviepy and finally I have video clip to be previewed inside PySide2 widget. But when I try to run videoClip.preview(), It just creates a new window and previewing it. Can we do the preview inside PySide2?

Thanks

  • 1
    It's not really straightforward. The `moviepy` viewer is an external window which does not use the Qt toolkit. It may be possible to embed it, but that is not really supported by Qt at moment, so it may not work on your platform. There is a [related question here](https://stackoverflow.com/q/58816766/984421) that shows how to go about it. Something like that *might* also work with `moviepy` - but YMMV. – ekhumoro Nov 24 '19 at 14:57

1 Answers1

0

Like ekhumoro said, it is not sure whether the following solution will be well treated by PySide2, but you should give it a try anyway :

After you generate your moviepy viewer, write :

# create a widget which will contain your external viewer :
container_widget = QtWidgets.QWidget()

# retrieve programmatically your external viewer (works for Windows OS only) :
hwnd = win32gui.FindWindow(None, "Name_of_your_external_window_viewer") 

# embed it inside your widget :
window = QtGui.QWindow.fromWinId(hwnd)
windowcontainer = createWindowContainer(window, container_widget)

# then you want to add your windowcontainer inside a certain layout of your GUI:
gridLayout.addWidget(windowcontainer, 0, 0, 1, 1)
Foussy
  • 287
  • 2
  • 11