Package org.apache.openmeetings.db.entity.record

Examples of org.apache.openmeetings.db.entity.record.FlvRecording


      return new Folder<FlvRecording>(id, this, node) {
        private static final long serialVersionUID = 1020976220467419084L;

        @Override
        protected Component newLabelComponent(String id, final IModel<FlvRecording> lm) {
          FlvRecording r = lm.getObject();
          Component result = r.isFolder() || r.getFlvRecordingId() < 1 ? new RecordingPanel(id, lm) : new RecordingItemPanel(id, lm, errorsDialog);
          if (r.getFlvRecordingId() > 0) {
            result.add(new DragSource(Operation.MOVE) {
              private static final long serialVersionUID = 1L;

              @Override
              public void onBeforeDrop(Component drag, Transfer transfer) throws Reject {
                transfer.setData(lm.getObject());
              };
             
              @Override
              public void onAfterDrop(AjaxRequestTarget target, wicketdnd.Transfer transfer) {
                transfer.setData(null);
              }
            }.drag("div"));
          }
          if (r.getFlvRecordingId() < 0 || r.isFolder()) {
            result.add(new DropTarget(Operation.MOVE) {
              private static final long serialVersionUID = 1L;

              @Override
              public void onDrop(AjaxRequestTarget target, Transfer transfer, Location location) throws Reject {
                FlvRecording p = lm.getObject();
                long pid = p.getFlvRecordingId();
                FlvRecording r = transfer.getData();
                r.setParentFileExplorerItemId(pid > 0 ? pid : null);
                r.setOrganization_id(p.getOrganization_id());
                r.setOwnerId(p.getOwnerId());
                getBean(FlvRecordingDao.class).update(r);
                target.add(trees); //FIXME add correct refresh
              }
            }.dropCenter("div"));
          }
          return result;
        }
       
        @Override
        protected boolean isSelected() {
          return getModelObject().getFlvRecordingId() == rm.getObject().getFlvRecordingId();
        }
       
        @Override
        protected boolean isClickable() {
          return true;
        }
       
        @Override
        protected void onClick(AjaxRequestTarget target) {
          FlvRecording r = getModelObject();
          FlvRecording _prev = rm.getObject();
          rm.setObject(r);
          if (_prev != null) {
            if (_prev.isFolder()) {
              selected.updateBranch(_prev, target);
            } else {
              selected.updateNode(_prev, target);
            }
          }
           selected = RecordingTree.this;
          if (r.isFolder()) {
            if (getState(r) == State.COLLAPSED) {
              super.onClick(target);
            }
            updateBranch(r, target);
          } else {
            video.update(target, r);
            info.update(target, r);
            updateNode(r, target);
          }
        }
       
        @Override
        protected String getOtherStyleClass(FlvRecording t) {
          String style;
          if (t.getFlvRecordingId() == 0) {
            style = "my-recordings om-icon";
          } else if (t.getFlvRecordingId() < 0) {
            style = "public-recordings om-icon";
          } else {
            style = t.isFolder() ? super.getOtherStyleClass(t)
                : (isRecordingExists(t.getFileHash() + MP4_EXTENSION) ? "recording om-icon" : "broken-recording om-icon");
          }
          if (isSelected()) {
            style += " selected";
          }
          return style;
        }
       
        @Override
        protected String getOpenStyleClass() {
          String style;
          FlvRecording r = getModelObject();
          if (r.getFlvRecordingId() == 0) {
            style = "my-recordings om-icon";
          } else if (r.getFlvRecordingId() < 0) {
            style = "public-recordings om-icon";
          } else {
            style = super.getOpenStyleClass();
          }
          return style;
        }
       
        @Override
        protected String getClosedStyleClass() {
          String style;
          FlvRecording r = getModelObject();
          if (r.getFlvRecordingId() == 0) {
            style = "my-recordings om-icon";
          } else if (r.getFlvRecordingId() < 0) {
            style = "public-recordings om-icon";
          } else {
            style = super.getClosedStyleClass();
          }
          return style;
View Full Code Here


 
  class MyRecordingTreeProvider extends RecordingTreeProvider {
    private static final long serialVersionUID = 1L;

    public Iterator<? extends FlvRecording> getRoots() {
      FlvRecording r = new FlvRecording();
      r.setFlvRecordingId(0);
      r.setFileName(WebSession.getString(860));
      r.setOwnerId(getUserId());
      return Arrays.asList(r).iterator();
    }
View Full Code Here

    try {
      if (isUseOldStyleFfmpegMap()) {
        FFMPEG_MAP_PARAM = ".";
      }

      FlvRecording flvRecording = recordingDao.get(flvRecordingId);
      log.debug("flvRecording " + flvRecording.getFlvRecordingId());

      // Strip Audio out of all Audio-FLVs
      stripAudioFromFLVs(flvRecording);

      // Add empty pieces at the beginning and end of the wav
View Full Code Here

    startConversion(flvRecordingId, false, new ReConverterParams());
  }

  public void startConversion(Long flvRecordingId, boolean reconversion, ReConverterParams rcv) {
    try {
      FlvRecording flvRecording = recordingDao.get(flvRecordingId);
      log.debug("flvRecording " + flvRecording.getFlvRecordingId());

      List<ConverterProcessResult> returnLog = new ArrayList<ConverterProcessResult>();
      List<String> listOfFullWaveFiles = new LinkedList<String>();
      File streamFolder = getStreamFolder(flvRecording);
      List<FlvRecordingMetaData> metaDataList = metaDataDao.getAudioMetaDataByRecording(flvRecording.getFlvRecordingId());
 
      stripAudioFirstPass(flvRecording, returnLog, listOfFullWaveFiles, streamFolder, metaDataList);
   
      // Merge Wave to Full Length
      File streamFolderGeneral = getStreamsHibernateDir();

      String hashFileFullName = "INTERVIEW_" + flvRecording.getFlvRecordingId() + "_FINAL_WAVE.wav";
      String outputFullWav = streamFolder.getAbsolutePath() + File.separatorChar + hashFileFullName;
      deleteFileIfExists(outputFullWav);

      if (listOfFullWaveFiles.size() == 1) {
        outputFullWav = listOfFullWaveFiles.get(0);
      } else if (listOfFullWaveFiles.size() > 0) {
        String[] argv_full_sox;
        if (reconversion) {
          argv_full_sox = mergeAudioToWaves(listOfFullWaveFiles, outputFullWav, metaDataList, rcv);
        } else {
          argv_full_sox = mergeAudioToWaves(listOfFullWaveFiles, outputFullWav);
        }

        returnLog.add(ProcessHelper.executeScript("mergeAudioToWaves", argv_full_sox));
      } else {
        // create default Audio to merge it.
        // strip to content length
        File outputWav = new File(streamFolderGeneral, "one_second.wav");

        // Calculate delta at beginning
        Long deltaTimeMilliSeconds = flvRecording.getRecordEnd().getTime() - flvRecording.getRecordStart().getTime();
        Float deltaPadding = (Float.parseFloat(deltaTimeMilliSeconds.toString()) / 1000) - 1;

        String[] argv_full_sox = new String[] { getPathToSoX(), outputWav.getCanonicalPath(), outputFullWav, "pad", "0", deltaPadding.toString() };

        returnLog.add(ProcessHelper.executeScript("generateSampleAudio", argv_full_sox));
      }
      // Default Image for empty interview video pods
      final File defaultInterviewImageFile = new File(streamFolderGeneral, "default_interview_image.png");

      if (!defaultInterviewImageFile.exists()) {
        throw new Exception("defaultInterviewImageFile does not exist!");
      }

      final int flvWidth = 320;
      final int flvHeight = 260;
      final int frameRate = 25;
      // Merge Audio with Video / Calculate resulting FLV

      String[] pods = new String[2];
      boolean found = false;
      for (FlvRecordingMetaData meta : metaDataList) {
        File flv = new File(streamFolder, meta.getStreamName() + ".flv");

        Integer pod = meta.getInteriewPodId();
        if (flv.exists() && pod != null && pod > 0 && pod < 3) {
          String path = flv.getCanonicalPath();
          /*
           * CHECK FILE:
           * ffmpeg -i rec_316_stream_567_2013_08_28_11_51_45.flv -v error -f null file.null
           */
          String[] args = new String[] {getPathToFFMPEG()
              , "-i", path
              , "-an" // only input files with video will be treated as video sources
              , "-v", "error"
              , "-f", "null"
              , "file.null"};
          ConverterProcessResult r = ProcessHelper.executeScript("checkFlvPod_" + pod , args);
          returnLog.add(r);
          if ("".equals(r.getError())) {
            pods[pod - 1] = path;
          }
          found = true;
        }
      }
      if (!found) {
        ConverterProcessResult r = new ConverterProcessResult();
        r.setProcess("CheckFlvFilesExists");
        r.setError("No valid pods found");
        returnLog.add(r);
        return;
      }
      boolean shortest = false;
      List<String> args = new ArrayList<String>();
      args.add(getPathToFFMPEG());
      for (int i = 0; i < 2; ++i) {
        /*
         * INSERT BLANK INSTEAD OF BAD PAD:
         * ffmpeg -loop 1 -i default_interview_image.jpg -i rec_316_stream_569_2013_08_28_11_51_45.flv -filter_complex '[0:v]scale=320:260,pad=2*320:260[left];[1:v]scale=320:260[right];[left][right]overlay=main_w/2:0' -shortest -y out4.flv
         *
         * JUST MERGE:
         * ffmpeg -i rec_316_stream_569_2013_08_28_11_51_45.flv -i rec_316_stream_569_2013_08_28_11_51_45.flv -filter_complex '[0:v]scale=320:260,pad=2*320:260[left];[1:v]scale=320:260[right];[left][right]overlay=main_w/2:0' -y out4.flv
         */
        if (pods[i] == null) {
          shortest = true;
          args.add("-loop"); args.add("1");
          args.add("-i"); args.add(defaultInterviewImageFile.getCanonicalPath());
        } else {
          args.add("-i"); args.add(pods[i]);
        }
      }
      args.add("-i"); args.add(outputFullWav);
      args.add("-ar"); args.add("22050");
      args.add("-ab"); args.add("32k");
      args.add("-filter_complex");
      args.add(String.format("[0:v]scale=%1$d:%2$d,pad=2*%1$d:%2$d[left];[1:v]scale=%1$d:%2$d[right];[left][right]overlay=main_w/2:0%3$s"
          , flvWidth, flvHeight, shortest ? ":shortest=1" : ""));
      if (shortest) {
        args.add("-shortest");
      }
      args.add("-map"); args.add("0:0");
      args.add("-map"); args.add("1:0");
      args.add("-map"); args.add("2:0");
      args.add("-r"); args.add("" + frameRate);
      args.add("-qmax"); args.add("1");
      args.add("-qmin"); args.add("1");
      args.add("-y");
      String hashFileFullNameFlv = "flvRecording_" + flvRecording.getFlvRecordingId() + ".flv";
      String outputFullFlv = new File(streamFolderGeneral, hashFileFullNameFlv).getCanonicalPath();
      args.add(outputFullFlv);
      // TODO additional flag to 'quiet' output should be added
      returnLog.add(ProcessHelper.executeScript("generateFullBySequenceFLV", args.toArray(new String[]{})));

      flvRecording.setFlvWidth(2 * flvWidth);
      flvRecording.setFlvHeight(flvHeight);

      flvRecording.setFileHash(hashFileFullNameFlv);

      // Extract first Image for preview purpose
      // ffmpeg -i movie.flv -vcodec mjpeg -vframes 1 -an -f rawvideo -s
      // 320x240 movie.jpg

      String hashFileFullNameJPEG = "flvRecording_" + flvRecording.getFlvRecordingId() + ".jpg";
      String outPutJpeg = new File(streamFolderGeneral, hashFileFullNameJPEG).getCanonicalPath();
      deleteFileIfExists(outPutJpeg);

      flvRecording.setPreviewImage(hashFileFullNameJPEG);

      String[] argv_previewFLV = new String[] { //
          getPathToFFMPEG(), //
          "-i", outputFullFlv, //
          "-vcodec", "mjpeg", //
          "-vframes", "100", "-an", //
          "-f", "rawvideo", //
          "-s", (2 * flvWidth) + "x" + flvHeight, //
          outPutJpeg };

      returnLog.add(ProcessHelper.executeScript("generateFullFLV", argv_previewFLV));

      String alternateDownloadName = "flvRecording_" + flvRecording.getFlvRecordingId() + ".avi";
      String alternateDownloadFullName = new File(streamFolderGeneral, alternateDownloadName).getCanonicalPath();
      deleteFileIfExists(alternateDownloadFullName);

      String[] argv_alternateDownload = new String[] { getPathToFFMPEG(), "-i", outputFullFlv, alternateDownloadFullName };

      returnLog.add(ProcessHelper.executeScript("alternateDownload", argv_alternateDownload));

      flvRecording.setAlternateDownload(alternateDownloadName);

      recordingDao.update(flvRecording);
      convertToMp4(flvRecording, returnLog);

      logDao.deleteByRecordingId(flvRecording.getFlvRecordingId());

      for (ConverterProcessResult returnMap : returnLog) {
        logDao.addFLVRecordingLog("generateFFMPEG", flvRecording, returnMap);
      }

View Full Code Here

        if (recordingList != null && recordingList.size() != 0) {
          // roomsListObject.setRoomList(roomList);
          RecordingObject[] recordingListItems = new RecordingObject[recordingList.size()];
          int count = 0;
          for (Iterator<FlvRecording> it = recordingList.iterator(); it.hasNext();) {
            FlvRecording flvRecording = it.next();
            recordingListItems[count] = new RecordingObject(flvRecording);
            count++;
          }

          return recordingListItems;
View Full Code Here

          FlvRecording[] recordingListItems = new FlvRecording[recordingList
              .size()];
          int count = 0;
          for (Iterator<FlvRecording> it = recordingList.iterator(); it
              .hasNext();) {
            FlvRecording flvRecording = it.next();
            recordingListItems[count] = flvRecording;
            count++;
          }

          return recordingListItems;
View Full Code Here

          FlvRecording[] recordingListItems = new FlvRecording[recordingList
              .size()];
          int count = 0;
          for (Iterator<FlvRecording> it = recordingList.iterator(); it
              .hasNext();) {
            FlvRecording flvRecording = it.next();
            recordingListItems[count] = flvRecording;
            count++;
          }

          return recordingListItems;
View Full Code Here

        currentClient.setIsRecording(false);

        sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
        log.debug("flvRecorderConverterTask ", flvRecorderConverterTask);

        FlvRecording flvRecording = flvRecordingDaoImpl.get(flvRecordingId);
        if (flvRecording.getIsInterview() == null || !flvRecording.getIsInterview()) {
          flvRecorderConverterTask.startConversionThread(flvRecordingId);
        } else {
          flvInterviewConverterTask.startConversionThread(flvRecordingId);
        }
      }
View Full Code Here

    }
  }

  public void addRecordingByStreamId(IConnection conn, String streamId, Client rcl, Long flvRecordingId) {
    try {
      FlvRecording flvRecording = flvRecordingDaoImpl.get(flvRecordingId);

      Date now = new Date();

      // If its the recording client we need another type of Meta Data
      if (rcl.getIsScreenClient()) {
        if (rcl.getFlvRecordingId() != null && rcl.isScreenPublishStarted()) {
          String streamName_Screen = generateFileName(flvRecordingId, rcl.getStreamPublishName().toString());

          log.debug("##############  ADD SCREEN OF SHARER :: " + rcl.getStreamPublishName());

          Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(flvRecordingId, rcl.getFirstname()
              + " " + rcl.getLastname(), now, false, false, true, streamName_Screen, rcl.getInterviewPodId());

          // Start FLV Recording
          recordShow(conn, rcl.getStreamPublishName(), streamName_Screen, flvRecordingMetaDataId, true,
              flvRecording.getIsInterview());

          // Add Meta Data
          rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);

          sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
        }
      } else if (rcl.getIsAVClient()
          && (rcl.getAvsettings().equals("av") || rcl.getAvsettings().equals("a") || rcl.getAvsettings().equals("v"))) {
        // if the user does publish av, a, v
        // But we only record av or a, video only is not interesting

        String streamName = generateFileName(flvRecordingId, String.valueOf(rcl.getBroadCastID()).toString());

        // Add Meta Data
        boolean isAudioOnly = false;
        if (rcl.getAvsettings().equals("a")) {
          isAudioOnly = true;
        }
        boolean isVideoOnly = false;
        if (rcl.getAvsettings().equals("v")) {
          isVideoOnly = true;
        }

        Long flvRecordingMetaDataId = metaDataDao.addFlvRecordingMetaData(flvRecordingId, rcl.getFirstname() + " "
            + rcl.getLastname(), now, isAudioOnly, isVideoOnly, false, streamName, rcl.getInterviewPodId());

        // Start FLV recording
        recordShow(conn, String.valueOf(rcl.getBroadCastID()).toString(), streamName, flvRecordingMetaDataId, false,
            flvRecording.getIsInterview());

        rcl.setFlvRecordingMetaDataId(flvRecordingMetaDataId);

        sessionManager.updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
View Full Code Here

      Long user_level = userManager.getUserLevelByID(users_id);
      if (AuthLevelUtil.checkUserLevel(user_level)) {

        log.debug("updateFileOrFolderName " + flvRecordingId);

        FlvRecording flvRecording = flvRecordingDaoImpl.get(flvRecordingId);

        flvRecording.setPreviewImage(null);

        flvRecording.setProgressPostProcessing(0);

        flvRecordingDaoImpl.update(flvRecording);

        if (flvRecording.getIsInterview() == null || !flvRecording.getIsInterview()) {
          flvRecorderConverterTask.startConversionThread(flvRecordingId);
        } else {
          flvInterviewReConverterTask.startConversionThread(flvRecordingId, leftSideLoud, rightSideLoud, leftSideTime,
              rightSideTime);
        }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.db.entity.record.FlvRecording

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.