<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>
<div><br/>
Hello everybody,</div>

<div> </div>

<div>I'm stuck with a RTP related issue. In my project I'm streaming the contents of h.264 encoded video (mkv) files. On the "server" side I'm using Gstreamer with python bindings. Here is the code for playback:</div>

<div> </div>

<div>pipeline = Gst.parse_launch("filesrc location=file.mkv ! matroskademux ! rtph264pay config-interval=10 pt=96 ! udpsink host=192.168.137.1 port=5000")<br/>
pipeline.set_state(Gst.State.PLAYING)</div>

<div> </div>

<div>On the client side I have a VLC player accessing the stream using a sdp file:<br/>
v=0<br/>
c=IN IP4 192.168.137.11<br/>
m=video 5000 RTP/AVP 96<br/>
a=rtpmap:96 H264/90000</div>

<div> </div>

<div>The client sends commands to the server via messaging in order to control playback.</div>

<div> </div>

<div>Video playback works just fine. So far, so good.</div>

<div> </div>

<div><br/>
The problems start when I'm pausing/resuming and seeking.</div>

<div> </div>

<div>I'm pausing the stream with this code:<br/>
pipeline.set_state(Gst.State.PAUSED)</div>

<div> </div>

<div>and resuming with:<br/>
pipeline.set_state(Gst.State.PLAYING)</div>

<div> </div>

<div>The VLC instance keeps running.</div>

<div> </div>

<div>Pausing itself works, but on resume the client shows scrambled data for some time and then resumes. I guess the video playback continues correctly when it hits the next keyframe. I've did some experiments with different key-int-max settings when encoding the videos and the delay reflects the settings.</div>

<div> </div>

<div>Can this be avoided? I.e. is there a solution where the client shows clean contents before the stream reaches the next keyframe?</div>

<div> </div>

<div><br/>
Seeking works even worse. My code is again pretty straightforward:<br/>
pipeline.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH, secs * Gst.SECOND)</div>

<div> </div>

<div>(The stream is in the playing state as required for FLUSH.)</div>

<div> </div>

<div>According to the docs in seek_simple the time is realtive to the start of the stream. As above, the VLC just keeps running.</div>

<div>This doesn't work at all. Again I'm getting the scrambled images, but much longer as in the pause/resume case (10-15 seconds). The time doesn't reflect my settings at all. After some time (around 10 seconds) the stream continues at a hardly reproducilbe timestamp, sometimes it seems that no seek at all happened, or jumps far forward when I want to seek to 1 second.</div>

<div> </div>

<div>There are no error messages of any kind.</div>

<div> </div>

<div>What is wrong with my code?</div>

<div> </div>

<div>I'm wondering if it is possible at all to seek to an arbitrary timestamp in my case.</div>

<div>What would be alternatives? Could working with RTSP help?</div>

<div><br/>
Thanks,<br/>
Pete</div>
</div></div></body></html>