× Warning! This forum is in archival status. New contributions may not work.
Record Output to a file every xx time from Airtime Output or Input (Alsa,Mic,and Icecast) - (How to)
  • Here is a modification with recording that output a file every hour

    I start this New post because  I want it to include features of  how to Use Sox and ffmpeg  and some scripts to do wonders
    This First section covers recording from the Input  a file which will done with new file name every hour
    Refer to this section for more details

    The second section shows how to record Airtime output.
    I chose this method so that you can record what is output before stream that is without sound card attached

    #######################################################################################################
    # Input from ALSA

    studioInput = input.alsa()
    urlstream=input.http("http://localhost:port/")

    # The output file
    # to be saved with parameters date and time
    outputfile = "/tmp/myrecordfile-%Y-%m-%d-%H-%M-%S.mp3"


    studioInput= amplify(2.0,input.alsa())

    myInput=mksafe(studioInput)
    myurlstream =mksafe(urlstream)


    StreamstudioInput = fallback(track_sensitive = false,[strip_blank(max_blank=10.,threshold=-35.,myInput),myurlstream])

    output.icecast( %mp3(stereo=true, bitrate=128, samplerate=44100),
                  password = "hackme", mount = "yourmount",
                  name = "metatag",
                  genre = "genre",
                  timeout = 10.0,
                  url = "yourwebsite",
                  description = "yourdescription",
                  StreamstudioInput             

                   )


    #with a newfile each time its open [append] and open that file every xxx time [reopen_when]
    #{0m0s} is every hour
    output.file(%mp3, output,fallible=true,append=true,reopen_when={0m0s},on_stop=shutdown,studioInput)


    ###############################END############################################################

    Steps
    1. The Inputs
    2. The backup Stream [ you can even use one your airtime stream like http://localhost:8000/stream]
    3. The output file  you want to save
    4. Amplify your input so it might give a better sound (optional)
    5. Make the source fallible
    6. Set up a fallback with silence that will cut off when there is no mic and either external stream or stream your output from Airtime
    7. Output  to Icecast as a Mount
    8. Output to a file and make a new file every hour

    You might have to do a few things such as

    Tweak the ls-script

    setup your card
     
    [MOVED TO HARTIME HACKS]
    Post edited by Voisses Tech at 2014-04-22 19:20:23
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • 3 Comments sorted by
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    nice
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Section 2
    For those who do not use  any input but want to record there whole Airtime Output before being streamed

    Just used the line  in green

    #************************************************************************************************************
    # The output file make sure you Airtime can write to this file eg. /tmp/myrecordfile
    # use permission 777 on other archive or file
    # to be saved with parameters date and time
    outputfile = "/tmp/myrecordfile-%Y-%m-%d-%H-%M-%S.mp3"

    #with a newfile each time its open [append] and open that file every xxx time [reopen_when]
    #{0m0s} is every hour
    output.file(%mp3, outputfile,fallible=true,append=true,reopen_when={0m0s},on_stop=shutdown,s)

    #done Bam


    #************************************************************************************************************

    eg. For 4hrs just change reopen_when={4h0m0s}

    • You can use a cron job or php to compress or delete this file
    •  If its store in /tmp/ remember its erased at any reboot so chose an archive directory eg Nfs and
    • set as watch folder for rebroadcast and use calendar to rebroadcast
    • If you want to save the recordings into wav,it require a little more ,I will post the solution soon

    Place this  at line  283 of the Ls-script to record everything including DJs
    Place this  at line  239 of the Ls-script to record everything except DJs

    Good Luck
    VOISSES
    Post edited by Voisses Tech at 2014-04-29 08:47:04
    Anyone reading this a find it funny about my grammar , I make no apology ,Go get a translator.
    "The Problem with education today is that it takes a university degree to switch on a light bulb"
    "You learn from your mistakes but wise people learn from others mistakes avoid Making mistakes there is not sufficient rooms to make them"
    "Innuendo","If's","Assumptions" and "Fear" are for politician.Who,What,where,When and How are for those seeking knowledge and care about Humanity.
    "I might be in Mud but that does not Make me a Wild Hog(pig)"
    “Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius — and a lot of courage to move in the opposite direction.”
    "The only thing that remains constant is change itself"
    May the force be with you,until our path or destiny bring us in tandem.
  • Nice! I use the section 2, it works perfect. The WAV solution would be interesting too ;)

    However, is it possible to choose time slots (ie. if I only want the 20:00-21:00 slot) ?
    Thanks