GithubHelp home page GithubHelp logo

pzhlkj6612 / streamlink-eplus_jp-object_storage Goto Github PK

View Code? Open in Web Editor NEW
12.0 2.0 0.0 137 KB

Process the live streaming or VOD from eplus.jp .

License: The Unlicense

Dockerfile 12.66% Shell 87.34%
digitalocean-spaces podman-pod azure-storage-blob vultr-storage linode-storage docker-images streamlink s3cmd

streamlink-eplus_jp-object_storage's Introduction

Streamlink, eplus.jp and Object Storage

DMCA is coming...?

What does this docker image do

  • Download the live streaming or VOD from eplus - Japan most famous ticket play-guide via Streamlink.
  • Transcode the downloaded TS file to MP4 via FFmpeg.
  • Upload both the TS and MP4 files to S3-compatible object storage via S3cmd or to Azure Storage container via Azure CLI.

Details

Storage requirement

For a 4-hour live event, the size of a MPEG-TS recording with the best quality is about 9.88 GB (9.2 GiB). Since we may transcode MPEG-TS to MP4 (a bit smaller) and keep both files, 20 GB free disk space is required.

Output

All output files are located in the "/SL-downloads" directory in the container. You are able to access those files locally by mounting a volume into that directory before creating the container (otherwise you may have to play with anonymous volumes).

Intermediate files. Those files will be renamed to "final files" before being uploaded:

# template:
${datetime}.${OUTPUT_FILENAME_BASE}.{ts,mp4} # full
${OUTPUT_FILENAME_BASE}.{ts,mp4}             # NO_AUTO_PREFIX_DATETIME

# example:
'20220605T040302Z.name-1st-Otoyk-day0.ts' # full
'name-1st-Otoyk-day0.ts'                  # NO_AUTO_PREFIX_DATETIME

Final files:

# template:
${datetime}.${OUTPUT_FILENAME_BASE}.${size}.${md5}.{ts,mp4} # full
${OUTPUT_FILENAME_BASE}.${size}.${md5}.{ts,mp4}             # NO_AUTO_PREFIX_DATETIME
${datetime}.${OUTPUT_FILENAME_BASE}.${md5}.{ts,mp4}         # NO_AUTO_FILESIZE
${datetime}.${OUTPUT_FILENAME_BASE}.${size}.{ts,mp4}        # NO_AUTO_MD5

# example:
'20220605T040302Z.name-1st-Otoyk-day0.123456789.0123456789abcdef0123456789abcdef.ts' # full
'name-1st-Otoyk-day0.123456789.0123456789abcdef0123456789abcdef.ts'                  # NO_AUTO_PREFIX_DATETIME
'20220605T040302Z.name-1st-Otoyk-day0.0123456789abcdef0123456789abcdef.ts'           # NO_AUTO_FILESIZE
'20220605T040302Z.name-1st-Otoyk-day0.123456789.ts'                                  # NO_AUTO_MD5
Variable Description
OUTPUT_FILENAME_BASE base file name (env)
datetime datetime at UTC in ISO 8601 format.
strftime(${datetime}, 17, "%Y%m%dT%H%M%SZ", gmtime(&(time(0))))
size file size.
du -b "$filepath"
md5 file hash.
md5sum "$filepath"

Prepare your object storage

AWS S3-compatible preparation (simpler)

Create your own object storage:

Environment variables:

Name Description
S3_BUCKET URL in s3://bucket-name/dir-name/ style
S3_HOSTNAME For example:
s3-eu-west-1.amazonaws.com
nyc3.digitaloceanspaces.com
us-east-1.linodeobjects.com
ewr1.vultrobjects.com
objects-us-east-1.dream.io
AWS_ACCESS_KEY_ID The access key
AWS_SECRET_ACCESS_KEY The secret key

Azure preparation

Create a service principal on Azure.

For azure-cli :

$ az login --use-device-code
$ az ad sp create-for-rbac --role 'Contributor' --name "${name}" --scopes "/subscriptions/${subscription}/resourceGroups/${resourceGroup}/providers/Microsoft.Storage/storageAccounts/${AZURE_STORAGE_ACCOUNT}"

Environment variables:

Name Description
AZ_SP_APPID Application (client) ID
AZ_SP_PASSWORD Client secret
AZ_SP_TENANT Directory (tenant) ID
AZURE_STORAGE_ACCOUNT Azure storage account
AZ_STORAGE_CONTAINER_NAME Storage container name

Launch the container

Docker

Install Docker Engine. I recommend that you use Compose V2 by executing the new docker compose command.

Create a service:

# docker-compose.yml

services:
  sl:
    image: docker.io/pzhlkj6612/streamlink-eplus_jp-object_storage
    volumes:
      - ./SL-downloads:/SL-downloads:rw
    environment:
      # base file name (required)
      - OUTPUT_FILENAME_BASE=

      # output file name configuration
      - NO_AUTO_PREFIX_DATETIME=
      - NO_AUTO_FILESIZE=
      - NO_AUTO_MD5=

      # MPEG-TS input control
      # only one input allowed; using file has the highest priority.

      # file
      # does NOT imply "NO_AUTO_PREFIX_DATETIME", "NO_AUTO_FILESIZE" and "NO_AUTO_MD5".
      # does imply "NO_DOWNLOAD_TS".
      - USE_EXISTING_MPEG_TS_VIDEO_FILE=

      # streamlink
      - EPLUS_JP_STREAM_URL=      # enable streamlink.
      - EPLUS_JP_STREAM_QUALITY=  # "best" by default.
      - STREAMLINK_RETRY_TOTAL_SECONDS=  # 42 seconds between attempts, 0 second (no retry) by default.
      - STREAMLINK_HLS_START_OFFSET=  # "--hls-start-offset", 00:00:00 by default.

      # direct download
      - MPEG_TS_VIDEO_FILE_URL=  # download a MPEG-TS video.

      # ffmpeg
      - GENERATE_STILL_IMAGE_MPEG_TS=  # generate a still image MPEG-TS video.

      # MPEG-TS output control
      # multiple outputs supported.

      # file
      - NO_DOWNLOAD_TS=  # do not save the MPEG-TS file.

      # rtmp
      - RTMP_TARGET_URL=     # enable RTMP streaming.

      # MP4 output control

      - NO_TRANSCODE=        # disable FFmpeg transcode.

      - GENERATE_DUMMY_MP4=  # generate a dummy MP4 file when "NO_TRANSCODE" is set.

      # uploading control

      - NO_S3=               # disable s3cmd.
      - NO_AZURE=            # disable azure-cli.

      # s3cmd
      - AWS_ACCESS_KEY_ID=
      - AWS_SECRET_ACCESS_KEY=
      - S3_BUCKET=
      - S3_HOSTNAME=
      - S3CMD_MULTIPART_CHUNK_SIZE_MB=  # "--multipart-chunk-size-mb", 15 by default.

      # azure-cli
      - AZURE_STORAGE_ACCOUNT=
      - AZ_SP_APPID=
      - AZ_SP_PASSWORD=
      - AZ_SP_TENANT=
      - AZ_STORAGE_CONTAINER_NAME=

Run it:

$ docker compose up sl

For developers who want to build the image themselves:

$ DOCKER_BUILDKIT=1 docker build --tag ${tag} .
  ^^^^^^^^^^^^^^^^^
     !important!

Podman

Install Podman. Create a pod and a "hostPath" volume:

# pod.yaml

apiVersion: v1
kind: Pod
metadata:
  name: sl
spec:
  volumes:
    - name: SL-downloads
      hostPath:
        path: ./SL-downloads
        type: Directory
  restartPolicy: Never
  containers:
    - name: sl
      image: docker.io/pzhlkj6612/streamlink-eplus_jp-object_storage
      resources: {}
      volumeMounts:
        - mountPath: /SL-downloads
          name: SL-downloads
      env:
        # Please refer to the "Docker" section.
        - name: # ...
          value: # "..."

Finally, play it:

$ podman play kube ./pod.yaml  # 開演!

For developers who want to build the image themselves:

$ podman build --tag ${tag} .

Credits

streamlink-eplus_jp-object_storage's People

Contributors

pzhlkj6612 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

streamlink-eplus_jp-object_storage's Issues

Downloading video help

Dear sir
Please tell the way to download video from elearn.brilliantpala.org step by step i have no knowledge in downloading videos via ffmpeg or any other software

Username 256436
Password 256436

As you directed i found the key in the preview tab but what is the next step to do ?

i didnt understood you said about saving as curl

please look the below link with key and key url

video link
https://elearn.brilliantpala.org/courses/103/contents/42178/

m3u8 url : https://d1j3vi2u94ebt0.cloudfront.net/institute/brilliantpalalms/courses/copy-of-jee-main-mfeatbaypup3/videos/transcoded/d65d4372c03642cf80a08bf51a54172f/720p/video.m3u8

key - Jmv���KͬN6.�}i�
key url (https://elearn.brilliantpala.org/api/v2.5/video_contents/42178/key/)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.