How to pause on the 1st frame?

This forum is about all development around libVLC.
GreaterDane
New Cone
New Cone
Posts: 8
Joined: 03 Oct 2019 21:23

How to pause on the 1st frame?

Postby GreaterDane » 28 Apr 2020 02:04

I'm trying to use libVLC++ to pause WMV and MPG videos on their first frames before the user plays them. Unfortunately, it's not been successful so far. Either the video plays more than a single frame by the time it pauses, or the video continues to slowly play.

For example, I've tried:

Code: Select all

m_pPlayer = new VLC::MediaPlayer(media); ... m_pPlayer->setRate(0.0); m_pPlayer->setPause(true); m_pPlayer->play(); m_pPlayer->setPause(true); m_pPlayer->setPosition(0); m_pPlayer->setRate(1.0);
With this code, the video very slowly plays a few frames before pausing. Is there a foolproof way to render only the first frame?

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: How to pause on the 1st frame?

Postby mfkl » 28 Apr 2020 09:42

Code: Select all

media.addOption(":start-paused");
--start-paused, --no-start-paused
Start paused
(default disabled)
Pause each item in the playlist on the first frame.
https://mfkl.github.io

GreaterDane
New Cone
New Cone
Posts: 8
Joined: 03 Oct 2019 21:23

Re: How to pause on the 1st frame?

Postby GreaterDane » 28 Apr 2020 18:40

@mfkl
Thanks for pointing me in the right direction! Unfortunately, the "--start-paused" option has similar issues. The MPG-1 videos play several frames before pausing, and the WMV videos aren't rendering at all until unpaused.

Code: Select all

std::vector<char*> options = { {"--avcodec-skiploopfilter=4"}, {"--avcodec-fast"} }; // Skip deblocking filter for speed on older devices. m_LibVLC = VLC::Instance(options.size(), options.data()); VLC::Media media(m_LibVLC, videoFile, VLC::Media::FromPath); media.addOption(":start-paused"); m_pPlayer = new VLC::MediaPlayer(media); m_pPlayer->play();
I'll update from 3.0.4 to 3.0.10 to see if this helps.

GreaterDane
New Cone
New Cone
Posts: 8
Joined: 03 Oct 2019 21:23

Re: How to pause on the 1st frame?

Postby GreaterDane » 28 Apr 2020 19:59

The issue persists in 3.0.10.

Are alternative decoder plugins available for MPEG1/MPEG-PS and WMV? If so, can I choose which decoder to use in libVLC? I've searched the documentation, but I don't see any set decoder/parser function.

pfurrie
Blank Cone
Blank Cone
Posts: 10
Joined: 15 Nov 2006 23:38

Re: How to pause on the 1st frame?

Postby pfurrie » 10 Jul 2020 20:21

Any luck on this? Currently using 3.0.11, and can't get VLC to start the video in a paused state showing the first frame. Am using MP4 files with AVC codec, and either get no video (until I press play) or it plays right away (no pause). Can't get the sought-after combination of being paused when opening a file and showing the first frame of that file.

GreaterDane
New Cone
New Cone
Posts: 8
Joined: 03 Oct 2019 21:23

Re: How to pause on the 1st frame?

Postby GreaterDane » 10 Jul 2020 21:56

Unfortunately this still doesn't work when using WMV or MPEG1-PS files.

@pfurrie, did you already try mfkl's solution for your MP4s? I think the feature may be decoder/codec-dependent.

@mfkl, can I file a bug somewhere for this issue?

mfkl
Developer
Developer
Posts: 740
Joined: 13 Jun 2017 10:41

Re: How to pause on the 1st frame?

Postby mfkl » 15 Jul 2020 19:14

@mfkl, can I file a bug somewhere for this issue?
https://trac.videolan.org/vlc/
https://mfkl.github.io

vlc_wmsw_user
New Cone
New Cone
Posts: 1
Joined: 09 Feb 2021 17:43

Re: How to pause on the 1st frame?

Postby vlc_wmsw_user » 09 Feb 2021 18:01

I'm having this same issue. Was it ever resolved? Or reported as a bug?

As a workaround I'm doing the following:

Code: Select all

$ vlc -q --fullscreen file:///home/pi/Desktop/blank_1080p.mp4 vlc://pause:300 file:///home/pi/Desktop/video.mp4 --no-audio -I oldrc --rc-unix /home/pi/vlcsocket
which brings up a blank screen and pauses there for up to 5 minutes. Then, when I'm ready to play my actual video

Code: Select all

echo "next" | nc -U -q 1 /home/pi/vlcsocket

Bill_V
New Cone
New Cone
Posts: 3
Joined: 29 Jul 2021 08:23

Re: How to pause on the 1st frame?

Postby Bill_V » 29 Jul 2021 08:34

Hi GreaterDane, did you get it fixed?
Andy another question here, I can actually hear the sound before player being paused, libvlc_audio_set_volume and libvlc_audio_set_mute don't work (I called them before or after calling Play )

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to pause on the 1st frame?

Postby Rémi Denis-Courmont » 29 Jul 2021 13:08

While it would be possible to start paused, it would result in no picture. In fact, depending on the input media format, it would potentially result in no tracks at all, since tracks can be dynamic.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

GreaterDane
New Cone
New Cone
Posts: 8
Joined: 03 Oct 2019 21:23

Re: How to pause on the 1st frame?

Postby GreaterDane » 29 Jul 2021 17:24

Hi GreaterDane, did you get it fixed?
Unfortunately, no. :( I moved on to other priorities and simply didn't switch to libvlc for therapy animation playback.
While it would be possible to start paused, it would result in no picture. In fact, depending on the input media format, it would potentially result in no tracks at all, since tracks can be dynamic.
When I see "start paused", I think "render the first video frame only". At least that's what I was hoping it would do, and I think other people would expect the same. The issues I ran into were with static WMV and MPEG-1 PS files on disk, nothing particularly dynamic.

Unpausing from this could even start playing from the very start, with audio and other tracks this time. Re-playing the first frame would not appear odd or unusual to a human.

Bill_V
New Cone
New Cone
Posts: 3
Joined: 29 Jul 2021 08:23

Re: How to pause on the 1st frame?

Postby Bill_V » 30 Jul 2021 05:43

@GreaterDane, thanks for reply, currently I have the problem: I can hear very short time sound before it has been paused. could you tell more about how to make sure silently playing before the 1st frame?


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 8 guests