Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

16
LINES

< > BotCompany Repo | #1024579 // ffmpeg_makeSpliceFilter

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2150L/14K).

// ranges: ranges in seconds
sS ffmpeg_makeSpliceFilter(L<DoubleRange> ranges) {
  new LS out;
  int i = 0;
  fOr (DoubleRange r : ranges) {
    int lbl = ++i;
    S start = ffmpeg_formatSeconds(r.start);
    S end = ffmpeg_formatSeconds(r.end);
    out.add("[0:v]trim=start=" + start + ":end=" + end + ",setpts=PTS-STARTPTS[v" + lbl + "]");
    out.add("[0:a]atrim=start=" + start + ":end=" + end + ",asetpts=PTS-STARTPTS[a" + lbl + "]");
  }
  S concat = "concat=n=" + l(ranges);
  out.add(joinMap(iota(i), j -> "[v" + j + "]") + concat + "[outv]");
  out.add(joinMap(iota(i), j -> "[a" + j + "]") + + concat + ":v=0:a=1[outa]");
  ret joinWithSemicolon(out);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1024579
Snippet name: ffmpeg_makeSpliceFilter
Eternal ID of this version: #1024579/10
Text MD5: 8ce9dcb073f2b99dbb16b6550cce47c1
Transpilation MD5: 4ee25b410f572eb94f40a1bdf0f9609c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-19 22:46:04
Source code size: 678 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 264 / 367
Version history: 9 change(s)
Referenced in: [show references]