Loop a file using playbin without artefacts

Nikos Chantziaras realnc at gmail.com
Thu May 21 12:21:11 PDT 2015


Doesn't loop here either. So I guess my method is not as reliable as I 
thought.

Maybe Nicolas' suggestion will work.


On 21/05/15 21:41, Arnaud Loonstra wrote:
> Found a bug while doing so:
>
>    File "zvideoplayer.py", line 131, in stop_vid
>      Gst.SeekType.END, 0, Gst.SeekType.NONE, Gst.CLOCK_TIME_NONE)
> OverflowError: int too big to convert
>
> Anyway your approach didn't help either..
>
> At play I do:
>
> self.playbin.set_state(Gst.State.PLAYING)
> self.playbin.get_state(Gst.CLOCK_TIME_NONE)
> self.playbin.seek(1.0, Gst.Format.TIME, Gst.SeekFlags.FLUSH |
> Gst.SeekFlags.SEGMENT,\
>       Gst.SeekType.END, 0, Gst.SeekType.NONE, 2147483647)
>
> then at SEGMENT_DONE:
>
> flags = Gst.SeekFlags.SEGMENT
> self.playbin.seek_simple(Gst.Format.TIME, flags, 0)
>
> The video freezes at the end and unlimited SEGMENT_DONE messages are
> spawned.
> A flush makes it loop again but with the artefacts.
>
> I found this in the debug log btw:
> 0:03:10.029841145 10795 0x7fa4440660a0 ERROR                  libav :0::
> Invalid level prefix
> 0:03:10.029951469 10795 0x7fa4440660a0 ERROR                  libav :0::
> error while decoding MB 101 9
>
> Happens exactly at the artefact moment.
>
> Video is here:
> https://github.com/raspberrypi/firmware/blob/master/opt/vc/src/hello_pi/hello_video/test.h264
>
>
> I've tested this on a desktop computer and a raspberry pi. Both show
> artefacts.
>
> Arnaud
>
>
> On 2015-05-21 19:54, Nikos Chantziaras wrote:
>> I tried many approaches, and the way I ended up with that works very
>> reliably is to first put the pipeline into the playing state first,
>> wait for the transition to complete, and then do a seek to the end:
>>
>>   gst_element_set_state(pipeline, GST_STATE_PLAYING);
>>   // Wait for the state change to complete.
>>   gst_element_get_state(pipeline, 0, 0, GST_CLOCK_TIME_NONE);
>>   // Seek to the end.
>>   gst_element_seek(pipeline, 1.0, GST_FORMAT_TIME,
>>                    GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_SEGMENT,
>>                    GST_SEEK_TYPE_END, 0, GST_SEEK_TYPE_NONE,
>>                    GST_CLOCK_TIME_NONE);
>>
>> The above is in my play() routine. In the event handler for
>> GST_MESSAGE_SEGMENT_DONE, I simply do:
>>
>>   gst_element_seek_simple(pipeline, GST_FORMAT_TIME,
>>                           GST_SEEK_FLAG_SEGMENT, 0);
>>
>> This works extremely well for all videos (except for segmented MP4
>> files intended for online streaming; a known GStreamer limitation.)
>>
>> Are you really sure the artifacts you're seeing aren't actually part
>> of the video? Can you post the video somewhere to see if it's
>> reproducible by others? Also, have you tried other videos? Do you get
>> the problem with other videos as well?




More information about the gstreamer-devel mailing list