Video timeline



  • Hello,

    I am trying to implement video output in my QtQuick application. One requirement is to show a timeline below the video output proper. The timeline should show frames from the video taken in certain (configurable) time intervals. My search into the Qt video API's has brought no results, so I am posting my question here (and in the QtQuick forum, but I think this is not QtQuick-specific). Are there any tools or API's that can help me along with my request? Any hints how to tackle this task?

    thanks,
    chris


  • Moderators

    Hi gs_chris!
    Video output in QtQuick is pretty easy:

    import QtQuick 2.4
    import QtQuick.Controls 1.3
    import QtQuick.Window 2.2
    import QtMultimedia 5.4
    
    ApplicationWindow {
        title: qsTr("Hello world")
        width: 640
        height: 480
        visible: true
    
        Video {
            source:"file:///home/user/1.mp4"
            anchors.fill: parent
            autoPlay: true
        }
    
    }
    

    To grab frames you can use QML item's function bool grabToImage(callback, targetSize).

    Hope this helps!
    Wieland



  • @Wieland

    thanks for the reply. Didnt know about grabToImage, learned something already. However, since the timeline should show content not yet rendered, that function does not seem to help much. In fact, since the video files can be quite large, it seems reasonable to render the timeline into on-disk files first, and then present them to the user as needed. That rendering into files will probably have to be done offline, so QtQuick would not be involved. Remains the question how to best do the QML rendering proper.

    regards,
    Christian


  • Moderators

    I see. I don't think that Qt provides any capabilities for offline frame grabbing of videos. What operating systems do you target?



  • @Wieland said:

    What operating systems do you target?

    all of them ;). Seriously: Windows, Linux, OS/X iOS, Android


  • Moderators

    Maybe ffmpeg can provide what you're looking for.



  • @Wieland

    yes, there are ways, and ffmpeg/libav is one. However, thinking of it again (just getting started into this), it would be stupid to have MediaPlayer render the video file and at the same time process it elsewhere to produce timeline pictures. I would much rather use one and the same APi. Since we have very specific requirements (not end-user multimedia presentation), we may end up abandoning MediaPlayer altogether and creating our own architecture which can do video rendering and at the same time provide the timeline.

    I still do think, however, that a timeline is basic functionality of any video player and should be part of Qt's media offering as well

    regards,
    chris


  • Moderators

    @gs_chris May be this could help you.



  • @p3c0

    looks interesting, thank you. My only fear is that the comments are primarily in chinese;). libopenshot is another option. However, in the meantime after taking a thought roundtrip, and given the improvements announced for the 5.5 release, I think I would like to stay inside the QtMultimedia architecture as much as possible. What I am looking for, therefore, is some guidance how to tackle the timeline issue (extracting frames across the whole extent of the video medium) by using/extending/replacing components in QtMultimedia..

    thanks,
    chris



  • just for the records: my investigation into the Qt (5.5) code base and the mailing lists and fora have shown that there is no way to use the Qt APIs for my purpose. There once (5.0) was a plan to include something like QVideoDecoder in QtMultimedia, but that item has since disappeared.

    My solution is to wrap ffmpeg and use that


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.