Skip to content

Commit

Permalink
Transcode Support
Browse files Browse the repository at this point in the history
- Rebase to Alpine
- Smaller image
- Transcode to H.264
- Files end with .mp4 now
- Target arch: linux/386,linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/s390x
  • Loading branch information
kjake committed Mar 24, 2024
1 parent 82e0772 commit 2b67e7d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ jobs:
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/386,linux/amd64,linux/arm64/v8,linux/arm/v5,linux/arm/v7,linux/ppc64le,linux/s390x
platforms: linux/386,linux/amd64,linux/arm64/v8,linux/arm/v6,linux/arm/v7,linux/ppc64le,linux/s390x
tags: ${{ env.IMAGE_NAME }}:latest
push: true
44 changes: 13 additions & 31 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,19 @@
FROM python:latest
LABEL maintainer=kjake
FROM python:alpine
LABEL maintainer="kjake"

ENV streamlinkCommit=8d73b096066e3a84af4057f5aa589f7a65e5ab34
#ENV streamlinkVersion=6.0.1
#ENV PATH "${HOME}/.local/bin:${PATH}"

#ADD https://github.com/streamlink/streamlink/releases/download/${streamlinkVersion}/streamlink-${streamlinkVersion}.tar.gz /opt/
RUN apk add --update --no-cache && \
apk add --no-cache gosu --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing/ && \
apk add --no-cache py3-pip jq git ffmpeg ca-certificates && \
pip3 install --upgrade git+https://github.com/streamlink/streamlink.git@${streamlinkCommit} && \
echo 'export PATH="${HOME}/.local/bin:${PATH}"' && \
mkdir /home/download && \
mkdir /home/script && \
mkdir /home/plugins && \
apk del git && \
rm -rf /var/cache/apk/* /tmp/* /var/tmp/ ~/.cache/pip

#RUN apt-get update && apt-get install gosu

#RUN pip3 install versioningit

#RUN tar -xzf /opt/streamlink-${streamlinkVersion}.tar.gz -C /opt/ && \
# rm /opt/streamlink-${streamlinkVersion}.tar.gz && \
# cd /opt/streamlink-${streamlinkVersion}/ && \
# python3 setup.py install

RUN apt-get update && apt-get install gosu && apt-get install python3-pip -y

RUN pip3 install --upgrade git+https://github.com/streamlink/streamlink.git@${streamlinkCommit}

RUN apt-get update -y && \
apt-get install -y ffmpeg && \
apt-get install -y jq

RUN echo 'export PATH="${HOME}/.local/bin:${PATH}"'

RUN mkdir /home/download
RUN mkdir /home/script
RUN mkdir /home/plugins

#RUN git clone https://github.com/Damianonymous/streamlink-plugins.git
#RUN cp /streamlink-plugins/*.py /home/plugins/

COPY ./streamlink-recorder.sh /home/script/
COPY ./entrypoint.sh /home/script
Expand All @@ -40,4 +22,4 @@ RUN ["chmod", "+x", "/home/script/entrypoint.sh"]

ENTRYPOINT [ "/home/script/entrypoint.sh" ]

CMD /bin/sh ./home/script/streamlink-recorder.sh ${streamOptions} ${streamLink} ${streamQuality} ${streamName} ${streamPoll}
CMD /bin/sh /home/script/streamlink-recorder.sh ${streamOptions} ${streamLink} ${streamQuality} ${streamName} ${streamPoll}
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# docker-streamlink-recorder

Automated Dockerfile to record livestreams with streamlink forked from KimPig/streamlink-recorder-mp4
Automated Dockerfile to record livestreams as H.264/MP4 videos using [streamlink](https://github.com/streamlink/streamlink). Forked from [KimPig/streamlink-recorder-mp4](https://github.com/KimPig/streamlink-recorder-mp4).

## Description

Expand Down Expand Up @@ -52,6 +52,4 @@ services:

`gid` - GROUP ID, map to your desired Group ID (fallback to 9001)

The stream file will be named as `streamName - Year-Month-Day HourMinuteSecond - streamTitle.mkv`.

#### Working on mp4 remuxing.
The stream file will be named as `streamName - Year-Month-Day HourMinuteSecond - streamTitle.mp4`.
2 changes: 1 addition & 1 deletion streamlink-recorder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ while [ true ]; do
# Extract stream title from JSON
streamTitle=$(echo $streamInfo | jq -r '.metadata.title')
# Download and convert stream
streamlink $streamOptions $streamLink $streamQuality -o "/home/download/${streamName} - ${streamDate} - ${streamTitle}.mkv"
streamlink $streamOptions $streamLink $streamQuality --ffmpeg-video-transcode h264 -o "/home/download/${streamName} - ${streamDate} - ${streamTitle}.mp4"
sleep ${streamPoll:-60}s
done

0 comments on commit 2b67e7d

Please sign in to comment.