Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use SetPtsFilter to set video pts? #232

Open
MrSSai opened this issue Apr 18, 2023 · 0 comments
Open

How to use SetPtsFilter to set video pts? #232

MrSSai opened this issue Apr 18, 2023 · 0 comments

Comments

@MrSSai
Copy link

MrSSai commented Apr 18, 2023

Hello,
I'm new in ws.schild. I want to do it like use ffmpeg -filter:v "setpts=0.5*PTS", but when I use SetPtsFilter() to VideoAttributes().addFilter() method, it doesn't work. This is my code, can you help me?

public class VideoTranscoder {
    public static void main(String[] args) throws EncoderException {
        String inputPath = "/home/user/video.mp4";
        String outputPath = "/home/user/output.mp4";


        SetPtsFilter setPtsFilter = new SetPtsFilter();
        setPtsFilter.addInputLabel("0.5*PTS");

        VideoAttributes video = new VideoAttributes();
        video.setCodec("libx264");
        video.setFrameRate(30);
        video.addFilter(setPtsFilter);

        EncodingAttributes attrs = new EncodingAttributes();
        attrs.setOutputFormat("mp4");
        attrs.setVideoAttributes(video);

        Encoder encoder = new Encoder();
        MultimediaObject mediaObject = new MultimediaObject(new File(inputPath));
        encoder.encode(mediaObject, new File(outputPath), attrs);
        System.out.println("Video transcoding complete.");
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant