lmms icon indicating copy to clipboard operation
lmms copied to clipboard

Add video support

Open regulus79 opened this issue 4 months ago • 0 comments

Description

This PR adds a new track and clip type, VideoTrack and VideoClip, for playing videos in sync with the music, primarily to make composing music for videos easier. The videos are played in dedicated VideoClipWindows which can be opened by double-clicking on the VideoClip after a video file has been loaded.

Partially fixes #2079 And #6837.

Implementation

This PR creates 5 new classes:

  • VideoTrack: A minimal new track for video clips.
  • VideoTrackView: Gui view class for VideoTrack.
  • VideoClip: Contains the video file path and a reference to a VideoClipWindow.
  • VideoClipView: Gui view class for VideoClip. As of writing this, the view is very minimal. I am planning to try adding frame previews over the length of the clip as a basic visualization.
  • VideoClipWindow: Window for playing videos. Uses Qt's QMediaPlayer and QVideoWidget to play the video file stored in its corresponding VideoClip. The implementation is still minimal, but I am planning to add at least a volume slider.

TODO

  • [ ] Add volume slider to VideoClipWindow.
  • [ ] Add a meaningful visualization to VideoClipView.
  • [ ] Prevent user from selecting non-video files which causes errors to be spammed.

Note

This PR makes use of Qt's Multimedia and MultimediaWidgets modules, which required adding them to CMakeLists.txt. I understand importing extra modules is not great, but I would love to hear your opinions on it.

Also, I added some code to get video clip splitting to work which is redundant with #7477. Once that PR is merged, some changes in ClipView.cpp can be removed.

Also, I required the ability for VideoClipWindow to receive a signal when the timeline position changed, but oddly enough, the playbackPositionChanged signal was only emitted by setPlayPos, not setToTime or setToTimeByTicks, which means that it is not triggered when the user drags the playhead. I fixed this by making setToTime and setToTimeByTicks also emit playbackPositionChanged.

And just for anyone wondering, the video clip audio is not routed through the mixer or exported with the song.

regulus79 avatar Oct 05 '24 18:10 regulus79