Skip to content

Commit 51ec0fc

Browse files
authored
Merge pull request #163 from xyloon/feature/ffmpeg_stream_transcoding
Adding stream transcoding in ffmpeg kernel
2 parents 9834236 + 3bf20c9 commit 51ec0fc

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

ffmpeg/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ RUN set -xe && \
161161
apt-get clean && \
162162
rm -rf /usr/local/ffmpeg_sources
163163

164+
# Stream transcoding
165+
COPY ./scripts/bootstrap.sh /opt/container/bootstrap.sh
166+
RUN chmod +x /opt/container/bootstrap.sh
167+
164168
# Backend.AI specifics
165169
COPY ./service-defs /etc/backend.ai/service-defs
166170
COPY ./policy.yml /etc/backend.ai/jail/policy.yml

ffmpeg/scripts/bootstrap.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh
2+
3+
USER_ID=${LOCAL_USER_ID:-9001}
4+
USER_NAME=work
5+
6+
export HOME="/home/$USER_NAME"
7+
8+
su - $USER_NAME -c "touch /home/work/ffmpeglog"
9+
10+
if (! [ -z ${INPUT_STREAM}] ) && ( ! [ -z ${OUTPUT_STREAM} ] ); then
11+
echo "nohup /usr/local/bin/ffmpeg -i $INPUT_STREAM -vcodec hevc_nvenc -f rtsp $OUTPUT_STREAM >> /home/work/ffmpeglog &" >> /home/work/ffmpeglog
12+
su - $USER_NAME -c "nohup /usr/local/bin/ffmpeg -i $INPUT_STREAM -vcodec hevc_nvenc -f rtsp $OUTPUT_STREAM >> /home/work/ffmpeglog &"
13+
else
14+
echo "INPUT_STREAM: $INPUT_STREAM" >> /home/work/ffmpeglog
15+
echo "OUTPUT_STREAM: $OUTPUT_STREAM" >> /home/work/ffmpeglog
16+
fi

0 commit comments

Comments
 (0)