I want to seek to a position before playing a video :
player= new VlcMediaPlayer(instance);
player->setPosition(pos);
player->setTime(time);
player->play();
but it does not work and instead I used this code:
player= new VlcMediaPlayer(instance);
player->play();
player->setPosition(pos);
player->setTime(time);
it now works but first plays the video (and shows some frames of the begining of the file) , is there any way to seek to a position before playing?
I don't know what VlcMediaPlayer is but seeking in libvlc is done with libvlc_media_player_set_time call. And as you can see in the documentation it requires to be called on the video being played. So you have to call play before you can call seek. But you can pause right after the play and then seek. That should do the job.
The link to the libvlc forum containing the similar question.
Related
Hello i am recording screen to video file with GStreamer ximagesrc element using QT.
I want to draw circles on mouse clicks locations.
Can someone give a hint how to achieve this, looking at GstVideoOverlay I understand that it is used only on playing video in some window and draw in that window not directly in video stream that could be saved to file. Guessing that GstVideoOverlayRectangle can help here, but i`m not sure...
Thanks :)
I would recommend to look at cairooverlay:
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good/html/gst-plugins-good-plugins-cairooverlay.html
I want to process frames with Qt. I use QMediaplayer to load a video.
I used the implmentation I found here. I have additional data stored as "frame by frame values" in a .csv file.
For this I want to get the exact frame number of the current frame which is processed in the "present" function of my QAbstractVideoSurface implementation. It works while playing/stopping and pausing the video, but not when I attach a slider to the video...it seems that the QMediaplayer is out of sync with the data which is displayed. I tried getting the current time of the QMediaplayer while being in the QAbstractVideoSurface::present() function but it just won't work. Setting the time from outside while the slider is being moved was also no success for me.
My main problem is that QVideoFrame::startTime() and QVideoFrame::stopTime() does not deliver correct results after QMediaPlayer::setPosition(int) was called!
Does anyone have ideas how I get the current frame number for a QVideoFrame?
I´m working with OMXPlayer on Raspberry.
Right now I have a loop(with Python2.7) to show videos and it works correctly.
But I have two problems:
1. When one video is finished, the Desktop will be shown for one second. And I don't want it. How can I change quickly to another video without showing the Desktop?
2. Another problem is that I wanna show some pictures too.. I know that OMXPlayer does not show images... Can I use another program in my code? But the user should not notice the change.
Thanks.
I was trying to figure this out too but I'm afraid it's not possible. It seams to me that omxplayer is only able to play a single video at a time and to play another video you have to run a new instance of the program. It takes a while to initialize, hence the gap between the videos.
That said, I figured a nasty way to get around it. When playing a video, you can extract it's last frame into a PNG file with ffmpeg. Then, you can play the video with omxplayer and use whatever graphical tools you have to display the picture fullscreen in the background. When the video ends, it disappears but the picture stays there and since it's the last frame of the video, it appears to just freeze at the end for a second, before the next video starts. Then, you just repeat the process. Hope it helps.
I have play video using AVPlayervewcontroller ,but I am facing issue to pause video.
It has a method to stop video than start from beging, but I want to pause video.
Please give me some ideas how can I achieve this?
Thanx
An AVPlayerViewController has an AVPlayer (its player). Tell the player to pause, or set the player's rate to 0. This pauses the video without resetting its playhead position.
AVplayerviewcontroller has audioPlayer property which access the the Player Object. To manage the playback, use the pause method. Read the full documentation here:- https://developer.apple.com/reference/avfoundation/avplayer/1387895-pause
Code example for reference:-
audioPlayer.pause()
I'm trying to implement a "frame by frame" function for users on the Video Widget from Qt Examples, but I didn't find how to do that with QMediaPlayer. I also want to get MetaData of a video file (e.g. how many frames per second, duration, etc...) but .metadata("Duration") function give nothing.
Is QMediaPlayer the right class to use ? If yes, how can I do what I want ?
If not what class do I have to use ?
Thanks for your help.