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).

1  
// ranges: ranges in seconds
2  
sS ffmpeg_makeSpliceFilter(L<DoubleRange> ranges) {
3  
  new LS out;
4  
  int i = 0;
5  
  fOr (DoubleRange r : ranges) {
6  
    int lbl = ++i;
7  
    S start = ffmpeg_formatSeconds(r.start);
8  
    S end = ffmpeg_formatSeconds(r.end);
9  
    out.add("[0:v]trim=start=" + start + ":end=" + end + ",setpts=PTS-STARTPTS[v" + lbl + "]");
10  
    out.add("[0:a]atrim=start=" + start + ":end=" + end + ",asetpts=PTS-STARTPTS[a" + lbl + "]");
11  
  }
12  
  S concat = "concat=n=" + l(ranges);
13  
  out.add(joinMap(iota(i), j -> "[v" + j + "]") + concat + "[outv]");
14  
  out.add(joinMap(iota(i), j -> "[a" + j + "]") + + concat + ":v=0:a=1[outa]");
15  
  ret joinWithSemicolon(out);
16  
}

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: 265 / 368
Version history: 9 change(s)
Referenced in: [show references]