Setting up an Audio Logger


I’ve struggled with getting this to work on Windows 10 so far. (due to time constraints) However, I’ll post an update to see about getting it working again.

I believe the issue was with the version of ffmpeg not finding the device correctly.

ffmpeg version N-72220-gd0ac2f5 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC)

The original post was set up using Windows 7, however it could have been anything.




Hello all,

One of the things I get to do is find creative ways to solve problems. One of these problems is the need of having an audio logger for radio stations. I need it for a cheap as possible, and as functional as possible. The short version of what I need is a solution that records audio continuously for an hour at a time, and stores the result as MP3 files.

Here is the very easy solution that I would like to share with you, that is free too:

As a courtesy note, I’d like to acknowledge this article that helped me greatly. I just needed to tweak it a little.

You will firstly need to download ffmpeg

Create the following files with their contents:


  REM This file records 1 hour at a time and stores the files in the logs path, with the date format YYYYMMDD_HHMM
  REM This file is the one that does that hard work.
  @echo off
  for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set monthsd=%%c%%b%%a)
  for /f "tokens=1-2 delims=/: " %%a in ("%TIME%") do (if %%a LSS 10 (set mytime=0%%a%%b) else (set mytime=%%a%%b))
  set outputpath=logs\%monthsd%_%mytime%.mp3
  ffmpeg -f dshow -i audio="Realtek HD Audio Input" -y -t 01:00:00 "%outputpath%"

UPDATE 2015 Augst 19

 REM This file records 1 hour at a time and stores the files in the logs path, with the folder as the date, and then the filename with the date format YYYYMMDD_HHMM.mp3
 REM Help initally from:
 @echo off
 for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set monthsd=%%c%%b%%a)
 for /f "tokens=1-2 delims=/: " %%a in ("%TIME%") do (if %%a LSS 10 (set mytime=0%%a%%b) else (set mytime=%%a%%b))
 if not exist e:\_logger\logs\%monthsd% mkdir e:\_logger\logs\%monthsd%
 set outputpath=e:\_logger\logs\%monthsd%\%monthsd%_%mytime%.mp3
  ffmpeg -f dshow -channels 1 -i audio="Realtek HD Audio Input" -y -t 01:00:00 "%outputpath%"
 REM Capture in 160k stereo MP3
 ffmpeg -f dshow -channels 2 -i audio="USB Audio CODEC " -y -t 01:00:00 -b:a 160k "%outputpath%"


' This script is trigged every hour to record the station
 ' It's a great and simple way to log audio
 set objShell = createobject("")
 objShell.Run("C:\Logger\log_hour.bat") , 0h


REM Remove older files
forfiles -p "C:\Logger\logs" -s -m *.mp3 -d -90 -c "cmd /c del @path"

You will need to find out the name of the device you want to record, whether this is a line in, or a microphone etc.   You can do so by running the following command:

ffmpeg -list_devices true -f dshow -i dummy

Then, just edit the log_hour.bat file and replace the text shown in red and you should be right!

I would suggest against using the Windows Task Scheduler, especially if you are working in a network environment and have complex permissions. Instead, use this program from Splinter Software. It works great.

To make it work, set up the file log_run.vbs to execute on the hour, every hour in your scheduler.  Using the VBS file instead of the BAT file we can have the program executing silently in the background, without the need to interrupt the user. You will see the task running as ffmpeg in the task manager.

While I have needed the files to be stored in YYYYMMDD_HHMM, you will find that the ordering of the day and month, is dependent on your localised computer settings.

Good luck! 😀

UPDATE: 2015 August 19

Having run this now for a couple of months, some clean up should be done too, if not for moving the files to a permanent backup site for long term archiving.

So, I have a couple of scripts that take care of this.

Firstly, to copy the files to a longer term solution of indefinite time frame (at this stage), I am just using a program called robocopy.

One to copy the files from S: to W:\SPL_Achives – this is all of the SPL log files, and the other to copy all of the audio log files to W:\audio

These are all locations on our network.

This batch file can be run on any computer on the network, which is mapped correctly.

robocopy S:  W:\SPL_Archives *.* /E /R:10 /W:5 /V /log+:spllog.txt /np 
robocopy L:\  W:\audio *.* /E /R:10 /W:5 /V /log+:spllog.txt /np

After doing these though, it’s also a good idea to clean up your original audio logging files path too. You can probably see if the clean_90_days.bat file that it does it nicely, but that is only half the problem. It’s good to delete the files, but, then you are stuck with lots of empty directories. This solution is quick as easy to implement.

This batch file is run ong the recoding computer, which hosts the original audio files.

REM remove files older than 30 days
forfiles -p E:\_Logger\logs -s -m *.mp3 -d -30 -c "cmd /c del @PATH"

REM remove the empty direcories
DeleteEmptyFolders.exe "E:\_Logger\logs\"

Just download this program, and you should be right for the deleting of the emty folders. (


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at

Up ↑

%d bloggers like this: