Recording container generates thumbnail on stop

pull/154/head
pabloFuente 2018-10-15 15:23:27 +02:00
parent ed7d8305e8
commit 3c200d3a46
4 changed files with 20 additions and 5 deletions

View File

@ -2,14 +2,14 @@ FROM ubuntu:16.04
MAINTAINER openvidu@gmail.com MAINTAINER openvidu@gmail.com
# Install Chrome # Install Chrome
RUN apt-get update && apt-get install -y wget RUN apt-get update && apt-get -y upgrade && apt-get install -y wget
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \ RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - && \
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list && \ echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | tee /etc/apt/sources.list.d/google-chrome.list && \
apt-get update && apt-get install -y google-chrome-stable apt-get update && apt-get install -y google-chrome-stable
# Install media packages # Install media packages
RUN apt-get install -y software-properties-common RUN apt-get install -y software-properties-common
RUN add-apt-repository ppa:mc3man/xerus-media RUN add-apt-repository ppa:jonathonf/ffmpeg-3
RUN apt-get update RUN apt-get update
RUN apt-get install -y ffmpeg pulseaudio xvfb RUN apt-get install -y ffmpeg pulseaudio xvfb

View File

@ -101,7 +101,7 @@ sleep 2
### Start recording with ffmpeg ### ### Start recording with ffmpeg ###
function4() { function4() {
<./stop ffmpeg -y -f alsa -i pulse -f x11grab -framerate 25 -video_size $RESOLUTION -i :$DISPLAY_NUM -c:a libfdk_aac -c:v libx264 -preset ultrafast -crf 28 -refs 4 -qmin 4 -pix_fmt yuv420p -filter:v fps=25 "/recordings/$VIDEO_NAME.$VIDEO_FORMAT" <./stop ffmpeg -y -f alsa -i pulse -f x11grab -framerate 25 -video_size $RESOLUTION -i :$DISPLAY_NUM -c:a aac -c:v libx264 -preset ultrafast -crf 28 -refs 4 -qmin 4 -pix_fmt yuv420p -filter:v fps=25 "/recordings/$VIDEO_NAME.$VIDEO_FORMAT"
} }
export -f function4 export -f function4
if [[ $CURRENT_UID != $USER_ID ]]; then if [[ $CURRENT_UID != $USER_ID ]]; then
@ -144,3 +144,17 @@ if [[ $CURRENT_UID != $USER_ID ]]; then
else else
function6 function6
fi fi
### Generate video thumbnail ###
function7() {
MIDDLE_TIME=$(ffmpeg -i /recordings/$VIDEO_NAME.$VIDEO_FORMAT 2>&1 | grep Duration | awk '{print $2}' | tr -d , | awk -F ':' '{print ($3+$2*60+$1*3600)/2}')
ffmpeg -ss $MIDDLE_TIME -i /recordings/$VIDEO_NAME.$VIDEO_FORMAT -vframes 1 -s 480x300 /recordings/$VIDEO_ID.jpg
}
export -f function7
if [[ $CURRENT_UID != $USER_ID ]]; then
su myuser -c "bash -c function7"
else
function7
fi

View File

@ -465,7 +465,8 @@ public class ComposedRecordingService {
private boolean isFileFromRecording(File file, String recordingId, String recordingName) { private boolean isFileFromRecording(File file, String recordingId, String recordingName) {
return (((recordingId + ".info").equals(file.getName())) return (((recordingId + ".info").equals(file.getName()))
|| ((RECORDING_ENTITY_FILE + recordingId).equals(file.getName())) || ((RECORDING_ENTITY_FILE + recordingId).equals(file.getName()))
|| (file.getName().equals(recordingName + ".mp4"))); || (recordingName + ".mp4").equals(file.getName())
|| (recordingId + ".jpg").equals(file.getName()));
} }
private String getFreeRecordingId(String sessionId, String shortSessionId) { private String getFreeRecordingId(String sessionId, String shortSessionId) {

View File

@ -1,6 +1,6 @@
server.address: 0.0.0.0 server.address: 0.0.0.0
server.ssl.enabled: true server.ssl.enabled: true
openvidu.recording.version: 2.1.0 openvidu.recording.version: 2.6.0