Giter Site home page Giter Site logo

proj_nhk's Introduction

proj_nhk

  • save nhk radio from nhk japan and use webserver to play image

progress 1

  • get main page: code 304
  • get audio file: code 403
  • solution: disable proxy

progress 2

  • target1: combine all audio files into one file
  • target2: use main page to get the url of audio files
    • solution: get config.xml
    • problem: error code 403 sometimes
      • cause: cookies expired?
        • answer: no; succeed on macOs
  • change route

progress 3

https://www.digitalocean.com/community/tutorials/how-to-set-up-a-video-streaming-server-using-nginx-rtmp-on-ubuntu-20-04
https://www.bilibili.com/read/cv1083415/

  • target1: set up the stream server (for test)
  • target2: use ffmpeg to upstream
    • solution: ffmpeg -re -i https://radio-stream.nhk.jp/hls/live/2023229/nhkradiruakr1/master48k.m3u8 -c:v copy -c:a aac -ar 44100 -ac 1 -f flv rtmp://localhost/live/stream
      • problem: keepalive request failed for 'https://radio-stream.nhk.jp/hls/live/2023229/nhkradiruakr1/20230903T220028/master48k/00927/master48k_00449.aac' with error: 'Input/output error' when opening url, retrying with new connection
    • solution: audio could be successfully pushed to the server, but need to combine with video for bili
    • solution: jpeg + x264 - steps: sudo apt-get install libx264-dev - steps: ./configure --enable-gpl --enable-libx264 --enable-openssl --enable-nonfree (ssl version >= 3.0.0)
    • solution: ffmpeg -framerate 60 -loop 1 -i "./g324.jpg" -i https://radio-stream.nhk.jp/hls/live/2023229/nhkradiruakr1/master48k.m3u8 -http_persistent 0 -vf "scale=1920:1080" -c:v libx264 -c:a aac -ar 44100 -ac 1 -f flv rtmp://localhost:1935/live/stream
      • problem: broken pipe for the video
      • assertion: frame rate set above 30
      • problem: broken video frame
        • solution: use original resolution
    • problem: Failed to update header with correct duration / Failed to update header with correct filesize
      • assertion: .m2u8 files not updated

progress 4

  • target1: nhk <-(ffmpeg/m3u8) jp vps (nginx stream server)-> <-(ffmpeg) local server
    • solution: ffmpeg -re -i http://45.32.60.242:8088/hls/stream.m3u8 -c:v copy -c:a aac -ar 44100 -ac 1 -maxrate 5000k -bufsize 20000k -f flv
      • note: re flag to make sure the processing speed is the same as raw input

progress 5

  • target: combine source A (video + audio) with source B (audio) to rtmp (A-video + B-audio)
    • installation: yt-dlp (python >= 3.8)
    • step1: sudo python3.8 $(which yt-dlp) -f 232 -g https://www.youtube.com/live/Lfl2Nj_QRXU?si=gyGJykghI9zz0oBs to get m3u8 (use -F to get all formats)
    • step1.5: sudo python3.8 $(which yt-dlp) -f 232 -g https://www.youtube.com/live/Lfl2Nj_QRXU?si=gyGJykghI9zz0oBs > ytb.list.txt
    • step2: ffmpeg -re -i $(cat ytb.list.txt) -re -i http://45.32.60.242:8088/hls/stream.m3u8 -map 0:v -map 1:a -c:v copy -c:a aac -f flv <url>
    • solution2: ffmpeg -re -i $(cat ytb.list.txt) -re -i https://radio-stream.nhk.jp/hls/live/2023229/nhkradiruakr1/master48k.m3u8 -map 0:v -map 1:a -c:v copy -c:a aac -f flv rtmp://localhost:1935/live/stream
  • problems: timeout for the youtube stream

progress 6

  • problem: the hk_server is not stable, may hanging at fetching the .ts file, while the -reconnect 1 flag is not working
    • solution: use the jp_server to directly push the .ts file to bili
    • patch: use crontab to restart the ffmpeg command and fetch the .m3u8 file every 30 minutes to avoid the timeout
      • problem: disconnected still
      • solution: use while : do done bash to auto reconnect, while use cron to update the source every 30 minutes
      • issue: the stream at bili is not stable, lagging every 10 seconds (Browser platform)

proj_nhk's People

Contributors

mzhyui avatar

Watchers

 avatar

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.