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

23
LINES

< > BotCompany Repo | #1019781 // cutVideo_jave (dev.)

JavaX fragment (include)

!include once #1017982 // JAVE/ffmpeg

static void cutVideo_jave(S inVideo, S outVideo, float offsetSeconds, float durationSeconds) {
  cutVideo_jave(toFile(inVideo), toFile(outVideo), offsetSeconds, durationSeconds);
}

static void cutVideo_jave(File inVideo, File outVideo, float offsetSeconds, float durationSeconds) ctex {
  new EncodingAttributes attrs;
  attrs.setOffset(offsetSeconds);
  attrs.setDuration(durationSeconds);
  //attrs.setVideoAttributes(new VideoAttributes);
  new AudioAttributes audio;
  audio.setCodec("libmp3lame");
  audio.setBitRate(128000);
  audio.setChannels(2);
  audio.setSamplingRate(44100);
  attrs.setAudioAttributes(audio);
  File tempOut = appendToFileName(outVideo, ".temp");
  print("Cutting " + f2s(inVideo) + " to " + f2s(outVideo) + " (" + durationSeconds + " seconds)");
  new Encoder().encode(inVideo, tempOut, attrs);
  forceRenameFile(tempOut, outVideo);
  print("  [done]");
}

Author comment

Began life as a copy of #1018574

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019781
Snippet name: cutVideo_jave (dev.)
Eternal ID of this version: #1019781/7
Text MD5: 9b6ccad36ab481d5ba0bf4f107eb0241
Author: stefan
Category: javax / audio
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-26 04:13:27
Source code size: 947 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 347 / 368
Version history: 6 change(s)
Referenced in: [show references]