mirror of https://github.com/OpenVidu/openvidu.git
Video recording from MKV to MP4
parent
1ec47a3bee
commit
13d231b9ab
|
@ -14,7 +14,7 @@ FRAMERATE="${FRAMERATE:-24}"
|
||||||
VIDEO_SIZE="$RESOLUTION"
|
VIDEO_SIZE="$RESOLUTION"
|
||||||
ARRAY=(${VIDEO_SIZE//x/ })
|
ARRAY=(${VIDEO_SIZE//x/ })
|
||||||
VIDEO_NAME="${VIDEO_NAME:-video}"
|
VIDEO_NAME="${VIDEO_NAME:-video}"
|
||||||
VIDEO_FORMAT="${VIDEO_FORMAT:-mkv}"
|
VIDEO_FORMAT="${VIDEO_FORMAT:-mp4}"
|
||||||
RECORDING_JSON="'${RECORDING_JSON}'"
|
RECORDING_JSON="'${RECORDING_JSON}'"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,11 @@ import org.springframework.stereotype.Component;
|
||||||
@Component
|
@Component
|
||||||
public class ServletCustomizer implements EmbeddedServletContainerCustomizer {
|
public class ServletCustomizer implements EmbeddedServletContainerCustomizer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void customize(ConfigurableEmbeddedServletContainer container) {
|
public void customize(ConfigurableEmbeddedServletContainer container) {
|
||||||
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
|
MimeMappings mappings = new MimeMappings(MimeMappings.DEFAULT);
|
||||||
mappings.add("mkv","video/x-matroska");
|
mappings.add("mp4", "video/mp4");
|
||||||
container.setMimeMappings(mappings);
|
container.setMimeMappings(mappings);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -103,7 +103,7 @@ public class ComposedRecordingService {
|
||||||
envs.add("RESOLUTION=1920x1080");
|
envs.add("RESOLUTION=1920x1080");
|
||||||
envs.add("FRAMERATE=30");
|
envs.add("FRAMERATE=30");
|
||||||
envs.add("VIDEO_NAME=" + videoId);
|
envs.add("VIDEO_NAME=" + videoId);
|
||||||
envs.add("VIDEO_FORMAT=mkv");
|
envs.add("VIDEO_FORMAT=mp4");
|
||||||
envs.add("USER_ID=" + uid);
|
envs.add("USER_ID=" + uid);
|
||||||
envs.add("RECORDING_JSON=" + recording.toJson().toJSONString());
|
envs.add("RECORDING_JSON=" + recording.toJson().toJSONString());
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ public class ComposedRecordingService {
|
||||||
recording.setHasVideo(infoUtils.hasVideo());
|
recording.setHasVideo(infoUtils.hasVideo());
|
||||||
|
|
||||||
if (openviduConfig.getOpenViduRecordingFreeAccess()) {
|
if (openviduConfig.getOpenViduRecordingFreeAccess()) {
|
||||||
recording.setUrl(this.openviduConfig.getFinalUrl() + "recordings/" + recording.getName() + ".mkv");
|
recording.setUrl(this.openviduConfig.getFinalUrl() + "recordings/" + recording.getName() + ".mp4");
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException | ParseException e) {
|
} catch (IOException | ParseException e) {
|
||||||
|
@ -311,7 +311,7 @@ public class ComposedRecordingService {
|
||||||
if (Recording.Status.stopped.equals(recording.getStatus())) {
|
if (Recording.Status.stopped.equals(recording.getStatus())) {
|
||||||
recording.setStatus(Recording.Status.available);
|
recording.setStatus(Recording.Status.available);
|
||||||
recording.setUrl(
|
recording.setUrl(
|
||||||
this.openviduConfig.getFinalUrl() + "recordings/" + recording.getName() + ".mkv");
|
this.openviduConfig.getFinalUrl() + "recordings/" + recording.getName() + ".mp4");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
recordingEntities.add(recording);
|
recordingEntities.add(recording);
|
||||||
|
@ -361,7 +361,7 @@ public class ComposedRecordingService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isFileFromRecording(File file, String recordingId) {
|
private boolean isFileFromRecording(File file, String recordingId) {
|
||||||
return (((recordingId + ".info").equals(file.getName())) || ((recordingId + ".mkv").equals(file.getName()))
|
return (((recordingId + ".info").equals(file.getName())) || ((recordingId + ".mp4").equals(file.getName()))
|
||||||
|| ((".recording." + recordingId).equals(file.getName())));
|
|| ((".recording." + recordingId).equals(file.getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,7 +385,7 @@ public class ComposedRecordingService {
|
||||||
while (!isPresent) {
|
while (!isPresent) {
|
||||||
try {
|
try {
|
||||||
Thread.sleep(150);
|
Thread.sleep(150);
|
||||||
File f = new File(this.openviduConfig.getOpenViduRecordingPath() + recordingId + ".mkv");
|
File f = new File(this.openviduConfig.getOpenViduRecordingPath() + recordingId + ".mp4");
|
||||||
isPresent = ((f.isFile()) && (f.length() > 0));
|
isPresent = ((f.isFile()) && (f.length() > 0));
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue