简体   繁体   English

使用vlcj编辑视频

[英]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. 标题可能有点误导,但我想问一下如何在面板中仅显示部分视频,例如,我只想在20:00的节目中仅显示17:00至18:00长视频。 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) 这是一段工作代码:(这里p1是我的面板,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: 在30秒开始播放:

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

Play from the beginning until 60 seconds in: 从开始播放到60秒:

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

Play between 30 and 60 seconds in: 在30到60秒之间播放:

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. 如果需要指定几分之一秒,也可以指定“ 30.5”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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