VideoHelp Forum




+ Reply to Thread
Results 1 to 3 of 3
  1. I am trying to record a self hosted aac m3u8 hls stream to record for multiple hours at a time.
    It is broadcasting in 10 second chunks at ~256k.

    I am able to record this through vlc via the gui. I am able to record 6+ hours (longest I have tried but no reason it would not go longer). I am able to open and play the streams on multiple devices outside my network for hours and hours with zero drops. I had this setup on my older r610 server 2x X5650-12core, 64gb ram, perc h700 w/ 6x 600gb 10k sas drives. It is running Ubuntu 18.04(no virtualization bare metal install).

    I am able to also record the stream at any specified length using streamlink with an aac output (same as input).

    Code:
    #!/bin/bash
    NOW=$(date +"%b-%d-%Y-%I-%Z")
    echo "Enter Channel Name [ID]:";read name;
    streamlink "hls://http://127.0.0.1:8888/$name.m3u8" best -o "$name-$NOW.aac"
    I can leave this run in a screen for a day and it works perfectly with playable/seekable output.
    I am also able to run this same command with a --hls-duration 00:00:00 and it will close out and save properly as well (with specified length).

    The problem is whenever I try to output the file to an mp3 using ffmpeg it craps the bed at exactly 2 hours.
    My guess is I am just missing some 'default' switch that I need to modify or something.

    This script was setup to allow me to specify the channel to record via $name and output for a specified time (keep in mind I know the script side of this works just fine and is not the issue) I have run this outside of my script with same variables with same result.

    Code:
    #!/bin/bash
    NOW=$(date +"%b-%d-%Y-%I-%Z")
    echo "Enter Channel Name [ID]:";read name;
    echo "Time To Record: [HR:MIN:SEC]";read length;
    ffmpeg -i http://127.0.0.1:8888/$name.m3u8 -acodec libmp3lame -ac 2 -ab 256k -t $length $name-$NOW.mp3

    for whatever reason this starts off with no issue. It always ends at the two hour mark.. notice time=02:00:26.51.

    Code:
    ....
    [hls,applehttp @ 0x23f21e0] Opening 'crypto+http://127.0.0.1:8888/AAC_Data/howardstern100/HLS_howardstern100_256k_v3/howardstern10...0112987_v3.aac' for reading
    [hls,applehttp @ 0x23f21e0] Failed to reload playlist 0speed=   1x
    [hls,applehttp @ 0x23f21e0] Opening 'crypto+http://127.0.0.1:8888/AAC_Data/howardstern100/HLS_howardstern100_256k_v3/howardstern10...0112988_v3.aac' for reading
    http://127.0.0.1:8888/howardstern100.m3u8: Input/output error
    size=  225830kB time=02:00:26.51 bitrate= 256.0kbits/s speed=   1x
    video:0kB audio:225829kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000381%
    R610:~ $
    So I had a couple of raspberry pi's laying around. I installed two different deb variants (rasbpian buster and ubuntu) on each of them. Got them all updated and all hosting the same content (streaming out on 127.0.0.1:8888). All three of them exit with the same error of Input/output err at the same time.... I am absolutly stumped... the resulting file is perfectly playable it just quits early.

    Again, I am able to record the stream with streamlink and output to an aac file. So I figured ok I have the time to play around what if I pull the file with streamlink and then convert the aac file to mp3 with ffmpeg. This also results in an error

    It records the aac file correctly and breaks that operation at the specified time. Then when ffmpeg is called it craps itself. Reports back:
    xxxx.aac Invalid data found while processing input.

    So I then thought ok so I will run it through ffmpeg to fix anything possibly wrong with the aac file first with the script below. This also reports the same error when ffmpeg opens the aac file for processing

    Code:
    #!/bin/bash
    NOW=$(date +"%b-%d-%Y-%I-%Z")
    echo "Enter Channel Name [ID]:";read name;
    echo "Time To Record: [HR:MIN:SEC]";read length;
    #/usr/bin/ffmpeg -i http://127.0.0.1:8888/$name.m3u8 -c copy  -t $length $name-$NOW.aac
    
    streamlink "hls://http://127.0.0.1:8888/$name.m3u8" best --hls-duration $length -o "$name-$NOW.aac"
    sleep 5s
    ffmpeg -i $name-$NOW.aac -c copy $name-$NOW-fixed.aac
    ffmpeg -i $name-$NOW-fixed.aac -ab 256k $name-$NOW.mp3

    I am completely at a loss as to what else to try. I have this running on three different pieces of hardware. All updated to the latest release versions..

    I have been unsuccessful at getting vlc to run from the cli (otherwise I would obviously just do that). If anyone can give me any pointers there that would be rad. Here are the VLC outputs from the gui prior to me streaming (which works)..

    Code:
    :sout=#transcode{vcodec=none,acodec=mp3,ab=256,channels=2,samplerate=44100,scodec=none}:file{dst=/home/name/Desktop/outputfile.mp3,no-overwrite} :no-sout-all :sout-keep
    Any help would be much appreciated. I have spent literally days playing with this with no luck..
    Neil
    Quote Quote  
  2. Image
    [Attachment 52690 - Click to enlarge]


    You can see all three boxes with same errored output after 2 hours... all three boxes can save via vlc gui or streamlink for many hours. It has to be something simple I am missing. Thanks again
    Neil
    Quote Quote  
  3. I think I may have found a way to do it through vlc cli but would love to know why it is broken in ffmpeg.
    Thanks again
    Neil
    Quote Quote  



Similar Threads

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