Seek into a RTSP video stream

455 views
Skip to first unread message

Daniel Oancea

unread,
Jul 9, 2010, 1:17:17 PM7/9/10
to gstreamer-java
Hello everybody,

I have a Linux machine having the VLC in a VoD setup mode.
Using the java bindings for gstreamer I was able to play the video
streams successfully. However I would like to seek into the video
stream. For example I would like to start to see the stream from a
tracked position (e.g. 0:23) until to the end.

I've tried the following code:

public static void main(String[] args) {
args = Gst.init("VoD player", args);
final PlayBinMediaPlayer player = new
PlayBinMediaPlayer("video",
Executors.newCachedThreadPool());

player.setURI(URI.create(args[0]));

SwingUtilities.invokeLater(new Runnable() {

@Override
public void run() {
// TODO Auto-generated method stub
VideoComponent vComp = new
VideoComponent();

player.setVideoSink(vComp.getElement());
JFrame frame = new JFrame("MyPlayer");
frame.getContentPane().add(vComp,
BorderLayout.CENTER);
frame.setPreferredSize(new
Dimension(400, 500));

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setVisible(true);
player.play();

long startNanos = 200000000000L;
long endNanos = 500000000000L;
boolean haveEnd = false;

Pipeline pipe = player.getPipeline();

pipe.getState();

int flags = SeekFlags.FLUSH |
SeekFlags.SEGMENT
| SeekFlags.ACCURATE;

if (haveEnd) {
pipe.seek(1.0, Format.TIME, flags, SeekType.SET,
startNanos,
SeekType.SET, endNanos);
} else {
pipe.seek(1.0, Format.TIME,
flags, SeekType.SET,
startNanos,
SeekType.NONE, -1);
}

pipe.play();
// player.play();

}
});

Gst.main();
}

The problem is that the client establish a RTSP session with VLC
server, starts playing from the beginning and after 3-4 sec is
pausing. If I'm using the code fro playing a file form my local disk,
is seeking correctly.

What I'm doing wrong?

Thank you very much.

Thanks,
-Daniel

Oancea Daniel

unread,
Jul 10, 2010, 8:38:56 AM7/10/10
to Farkas Levente, gstream...@googlegroups.com
Hello,

As far as I know, it does.
If I'm using the VLC client, I could seek into the video stream.

-Daniel

On Sat, Jul 10, 2010 at 9:32 AM, Farkas Levente <lfa...@lfarkas.org> wrote:
On 07/09/2010 07:17 PM, Daniel Oancea wrote:
> The problem is that the client establish a RTSP session with VLC
> server, starts playing from the beginning and after 3-4 sec is
> pausing. If I'm using the code fro playing a file form my local disk,
> is seeking correctly.

does vlc rtsp server support seek? only very few rtsp server support
seeking...

--
 Levente                               "Si vis pacem para bellum!"



--
________
Note:  If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer. Thank you.


Tal Shalif

unread,
Jul 10, 2010, 9:08:39 AM7/10/10
to gstream...@googlegroups.com
My usual bickering/advice: gstreamer-java is but a Java wrapper. Prove to yourself what you are trying to do is achievable without Java via gst-launch, C/C++ or gst-python before wondering why it does not work with Java.



--
You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
To post to this group, send email to gstream...@googlegroups.com.
To unsubscribe from this group, send email to gstreamer-jav...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/gstreamer-java?hl=en.

Reply all
Reply to author
Forward
0 new messages