bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.41k stars 1.57k forks source link

how to use xfade filter to merge two video ? #2133

Closed DearTan closed 7 months ago

DearTan commented 7 months ago

I want to use the xfade filter to merge two videos. What I know is that FFmpegFrameFilter acts on frame, so how to apply it to two videos? How to input video to grabber and record?? Console error message is:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'advert.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.3.100
  Duration: 00:03:08.64, start: 0.000000, bitrate: 118 kb/s
  Stream #0:0[0x1](und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(progressive), 1280x720, 566 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 57 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Output pad "default" with type video of the filter instance "setpts" of setpts not connected to any destination
org.bytedeco.javacv.FFmpegFrameFilter$Exception: avfilter_graph_config() error -22 (For more details, make sure FFmpegLogCallback.set() has been called.)
saudet commented 7 months ago

We can use multiple inputs like this: https://github.com/bytedeco/javacv/blob/master/platform/src/test/java/org/bytedeco/javacv/FrameFilterTest.java#L169

DearTan commented 7 months ago

It's different! I want to use xfade filter between different picture now,but FFmpegFrameFilter input are videos...

saudet commented 7 months ago

FFmpeg can load images as videos