Libvlc_media_player_set_position fails while looking back

I am using libvlc 3.0.0 (I also tried 2.2.0) to capture frames from an mp4 file encoded by h264 (does not include sound, only video frames) on Windows 7 with Visual Studio 2012. I can play, pause, stop and search forward without any problems. But when I try to look back, I have problems:

  • Scenario: if I only call libvlc_media_player_set_position (or libvlc_media_player_set_time ), it looks like it is moving to a position. But vlc stops sending received callbacks (in other words, the player freezes) until it reaches the same (or next) frame before calling the libvlc_media_player_set_position function.

     counter = 0; while (true) { sleep(40); // 25 hz ++counter; if(counter % 100 = 0) { // assuming current_position > 0.1f libvlc_media_player_set_position(p_mi, 0.1f); } } 
  • Scenario: I can make it work only if I first stopped the player and then started playing from the very beginning.

     counter = 0; while (true) { sleep(40); // 25 hz ++counter; if(counter % 100 = 0) { // assuming current_position > 0.1f libvlc_media_player_stop(p_mi); libvlc_media_player_play(p_mi); libvlc_media_player_set_position(p_mi, 0.1f); } } 

    The problem with this scenario is that if I go back a bit, I get an error (vlc prints an error on the command line) core decoder error: cannot continue streaming due to errors . After this error, it stops playing (it freezes again), and the next time I try to find, I get an "Access Violation" error: Unhandled exception at 0x... (libavcodec_plugin.dll) in vlctest.exe: 0xC0000005: Access violation reading location 0x00000040

It is not correct to restart the video for the search first. Did I miss something?

Thanks in advance!

+5
source share
1 answer

I don't know where I messed it up, but I downloaded the current nightly build vlc-3.0.0- git -20151221-0002-win32-debug.zip the nightly build video and now it works.

+1
source

Source: https://habr.com/ru/post/1238075/


All Articles