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

26
LINES

< > BotCompany Repo | #1006825 // Invert video (output to .mp4) [WORKS]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Uses 1860K of libraries. Click here for Pure Java version (2439L/17K/70K).

!7

import org.jcodec.api.awt.AWTSequenceEncoder8Bit;

static int framesToEncode = 100000;

p {
  inputFilePath("Video to modify", voidfunc(final File video) {
    thread {
      File outFile = prepareProgramFile(addSuffix("inverted-" + video.getName(), ".mp4"));
      AWTSequenceEncoder8Bit enc = AWTSequenceEncoder8Bit.create25Fps(outFile);
      enc.getEncoder().setKeyInterval(25);
      int n = 0;
      for (BufferedImage img : framesFromVideo_reordering(video)) {
        img = invertedImage(img);
        enc.encodeImage(img);
        
        print("Frames: " + n + "/" + framesToEncode);
        if (++n >= framesToEncode) break;
      }

      enc.finish();
      print("Wrote " + f2s(outFile) + " (" + n + " frames)");
    }
  });
}

Author comment

Began life as a copy of #1006716

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006825
Snippet name: Invert video (output to .mp4) [WORKS]
Eternal ID of this version: #1006825/10
Text MD5: d1340e433c15b056996f50a433607dd7
Transpilation MD5: 3903593e00ded09ffd0f0842329c8f65
Author: stefan
Category: javax video
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-05 05:28:08
Source code size: 772 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 511 / 696
Version history: 9 change(s)
Referenced in: #1006826 - Re-encode video without changes to see how fast that is
#1006827 - Invert video (output to .mp4), use 2 threads [seems to work]
#1006834 - Video to .jpegs [dev.]