Page 1 of 1

How to pause on the 1st frame?

Posted: 28 Apr 2020 02:04
by GreaterDane
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?

Re: How to pause on the 1st frame?

Posted: 28 Apr 2020 09:42
by mfkl

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.

Re: How to pause on the 1st frame?

Posted: 28 Apr 2020 18:40
by GreaterDane
@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.

Re: How to pause on the 1st frame?

Posted: 28 Apr 2020 19:59
by GreaterDane
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.

Re: How to pause on the 1st frame?

Posted: 10 Jul 2020 20:21
by pfurrie
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.

Re: How to pause on the 1st frame?

Posted: 10 Jul 2020 21:56
by GreaterDane
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?

Re: How to pause on the 1st frame?

Posted: 15 Jul 2020 19:14
by mfkl
@mfkl, can I file a bug somewhere for this issue?
https://trac.videolan.org/vlc/

Re: How to pause on the 1st frame?

Posted: 09 Feb 2021 18:01
by vlc_wmsw_user
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

Re: How to pause on the 1st frame?

Posted: 29 Jul 2021 08:34
by Bill_V
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 )

Re: How to pause on the 1st frame?

Posted: 29 Jul 2021 13:08
by RĂ©mi Denis-Courmont
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.

Re: How to pause on the 1st frame?

Posted: 29 Jul 2021 17:24
by GreaterDane
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.

Re: How to pause on the 1st frame?

Posted: 30 Jul 2021 05:43
by Bill_V
@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?