VideoHelp Forum
+ Reply to Thread
Results 1 to 2 of 2
Thread
  1. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    I have been using ffmpeg in order to download content from a streaming source into an mp4 file while converting the format to a smaller size (480P).
    Then when the download finishes I can view the content by playing the downloaded file.

    I have scripted it on a Linux server (no GUI there) so the downloads can be done unattended on off hours and viewed later (time zone differences).

    Now I wonder if there is a way to convert the download to something that can be viewed in real time as it is being recorded?

    If I set the target to a ts file instead of mp4, can it then be viewed while the download goes on?

    My current command in the script file looks like this:
    Code:
    CMD="ffmpeg -hide_banner -loglevel warning -referer \"${VIDEOURL}\" -i \"${M3U8URL}\" -r 30 -vf scale=w=-4:h=480 -c:v libx264 -preset fast -crf 26 -x264-params keyint=30:scenecut=0:open-gop=0 -c:a aac -t ${CAPTURETIME} ${TARGETFILE}"
    where:
    VIDEOURL is the source webpage which contains an embedded video player
    M3U8URL is the stream URL for the video on that player
    CAPTURETIME is the final video length in seconds
    TARGETFILE is the name of the output mp4 fiile

    How should I modify this command in order to make it produce a file that can be viewed at the same time the download runs?
    I think that the mp4 format is not suited since such files need to have a "moov" part that can only be written at the end of a download when the file is closed for writing by ffmpeg.
    So possibly converting into a ts file or similar would be a way?

    Or is there a better way to do it where the output can be viewed as it is being created?

    I use a web browser to connect to my Linux server to view the downloaded files, so something tah can be opened in a web browser would be the output I am after.

    Any suggestion welcome.
    Quote Quote  
  2. change to .ts
    Code:
    CMD="ffmpeg -hide_banner -loglevel warning -referer \"${VIDEOURL}\" -i \"${M3U8URL}\" -r 30 -vf scale=w=-4:h=480 -c:v libx264 -preset fast -crf 26 -x264-params keyint=30:scenecut=0:open-gop=0 -c:a aac -f mpegts ${TARGETFILE}.ts"
    play in web browser: http://<your-server-ip>:8000/${TARGETFILE}.ts
    Code:
    python3 -m http.server 8000
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!