简体   繁体   中英

Editing video using vlcj

The title may be a little misleading, but I wanted to ask that how do I show only a part of video in my panel, for example I want to show only 17:00 to 18:00 in my program out of a 20:00 long video. Is there a way to do it? Because I found no such method or im just not able to think of a way to do it. Here's a piece of the working code: (here p1 is my panel, so is p2)

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
        p = new Canvas();
        p.setSize(p1.getWidth(),p1.getHeight());
        o = new Canvas();
        p1.add(p);
        p2.add(o,BorderLayout.CENTER);
        m1 = new MediaPlayerFactory();
        m2 = new MediaPlayerFactory();
        e1 = m1.newEmbeddedMediaPlayer();
        e1.setVideoSurface(m1.newVideoSurface(p));
        e1.playMedia("E:\\My Folder\\Animes\\Naruto\\Naruto Shippuden\\Episodes\\Naruto Shippuden Episode 274\\[Narutoverse]_NARUTO_Shippuden_274_[720p].mkv");      // TODO add your handling code here:
    } 

Start playing at 30 seconds in:

mediaPlayer.playMedia(media, ":start-time=30");

Play from the beginning until 60 seconds in:

mediaPlayer.playMedia(media, ":stop-time=60");

Play between 30 and 60 seconds in:

mediaPlayer.playMedia(media, ":start-time=30", ":stop-time=60");

You can also specify eg "30.5" if you need to specify fractions of a second.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM