topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday December 12, 2024, 12:47 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Podcast Conversion and dates  (Read 6556 times)

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Podcast Conversion and dates
« on: March 21, 2011, 09:30 AM »
I am a bit of a podcast addict. Sadly, I get a bit behind and -- because I TRY to be organised -- I keep my podcasts in a single folder, so I can sort them in date order, and transfer the oldest first to my MP3 player.

Mostly, this works very well. But one of the podcasts I regularly get comes in M4A format. Although the software I use to transfer stuff to my player converts things on the fly, I prefer to do the conversion myself so I can control the output quality and filesize a bit better.

So far, I have found the easiest way to do this is to use fre:ac (the new version of BonkEnc, still free though) to do the conversion to MP3, output the files somewhere away from the originals, then use another little freebie (filedate) to re-datestamp the new files to match the originals, so they don't get sorted to the end of the list. Fiddly and time-consuming, especially if you've only just got round to it after a few weeks of letting M4As build up...

Two related requests, then. Either a program that can suck in an audio file (or a list of files) and squirt out an MP3 with the same time/datestamp as the original, optionally deleting the original... or if doing that is too complex for a "snack", a program that can display two lists of files, allow them to be lined up by hand in case filenames don't quite match, then apply the date/timestamps from the source list to the destination list.
-- bests, Tim

...this space unintentionally left blank.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,914
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #1 on: March 21, 2011, 09:32 AM »
interesting...  in thinking about a general purpose solution, one question is, can you keep the base filenames the same?
if so then a good general purpose solution might be an app that scans a directory and sets the file date stamps for all sets of files with same basename (and different extensions) to the date of earliest datestamp in the set.


skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #2 on: March 21, 2011, 11:17 AM »
Either a program that can suck in an audio file (or a list of files) and squirt out an MP3 with the same time/datestamp as the original

fre:ac actually comes with a commandline version in its install so that, combined with a small bit of AHK script, would make this a piece of cake.  Heck, you could even use the lame.exe file directly.  Do you have AutoHotkey installed?

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #3 on: March 21, 2011, 11:37 AM »
fre:ac actually comes with a commandline version in its install so that, combined with a small bit of AHK script, would make this a piece of cake.  Heck, you could even use the lame.exe file directly.  Do you have AutoHotkey installed?

I've got a portable copy somewhere, but I've never tried to use it. You're a proper programmer, I just pretend to know what it's about sometimes.  :-[

(I can sometimes write very simple and mechanistic black boxes -- take some input textfile, chop it up, put it back together in a different order, exit. Anything requiring screen design or direct access to the Windows API, I'm running away so fast people are choking on the dust.)
-- bests, Tim

...this space unintentionally left blank.

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #4 on: March 21, 2011, 11:56 AM »
Do you have AutoHotkey installed?

Okay, just had a bit of a look at the helpfile for it. It looks like a file loop could be used to retrieve the file list and operate on them one at a time, and if I can throw commands at fre:ac or Lame, I might even be able to puzzle something out.

What I'm less sure about is -- as I suggested previously -- putting a front end on it. To make it reliable, I'd want a front end on it that allowed the specification of the input and output sources and a path to LAME or fre:ac or whatever, and I suppose to make it bulletproof it'd probably have to be able to specify encoder options and suddenly it's looking like I really should be running away from all this ui stuff  :-[  :)
-- bests, Tim

...this space unintentionally left blank.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #5 on: March 21, 2011, 12:07 PM »
Here's a proof-of-concept script.  

  • Save this to <whatever>.ahk and put it in your fre:ac folder.
  • Edit the myOutputDir variable to an output folder of your choice.
  • Run the script.  You should see a small square begging for you to drop some files on it.
  • Drop some files on it!
  • They will be converted to mp3 and placed in your chosen output directory with the original modification times.

Code: Autohotkey [Select]
  1. ; Set up environment.
  2. SetWorkingDir, %A_ScriptDir%
  3.  
  4. ; Variables.
  5. AppName     := "Podblivion"
  6. myOutputDir := "c:\tmp2"
  7.  
  8. ; Build simple drop target.
  9. Gui, Add, Text, xm ym w150 h150 Center 0x200 vtxtDisplay, Drop files here...
  10. Gui, Show, , % AppName
  11. Return ; End of auto-execute section.
  12.  
  13.  
  14. GuiDropFiles:
  15. {
  16.     myFiles := A_GuiEvent
  17.     Loop, Parse, myFiles, `n
  18.     {
  19.         If ( A_LoopField != "" )
  20.         {
  21.             myFilePath := A_LoopField
  22.            
  23.             ; Notify user that we're doing something.
  24.             SetTimer, Progress, On
  25.            
  26.             ; Get modified time of dropped file.
  27.             FileGetTime, modTime, % myFilePath, M
  28.            
  29.             ; Crack path and form up output filename with mp3 extension.
  30.             SplitPath, myFilePath, , , , myFileNameNoExt
  31.             myOutputFile := myOutputDir . "\" . myFileNameNoExt . ".mp3"
  32.            
  33.             ; Set parameters for the freaccmd.exe program.
  34.             cmdParams := "-e LAME -m VBR -b -q 5 -d " . myOutputDir . " """ . myFilePath . """"
  35.            
  36.             ; Convert file.
  37.             RunWait, % A_ScriptDir . "\freaccmd.exe " . cmdParams, , Hide
  38.            
  39.             ; Set output file's modified time to input file's value.
  40.             FileSetTime, % modTime, % myOutputFile, M
  41.         }
  42.     }
  43.     SetTimer, Progress, Off
  44.     GuiControl, Text, txtDisplay, Drop files here...
  45. }
  46. Return
  47.  
  48.  
  49. {
  50.     GuiControl, Text, txtDisplay, Converting |
  51.     Sleep, 250
  52.     GuiControl, Text, txtDisplay, Converting /
  53.     Sleep, 250
  54.     GuiControl, Text, txtDisplay, Converting -
  55.     Sleep, 250
  56.     GuiControl, Text, txtDisplay, Converting \
  57.     Sleep, 250
  58. }
  59. Return
  60.  
  61.  
  62. {
  63.     ExitApp
  64. }
  65. Return

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #6 on: March 23, 2011, 05:17 AM »
interesting...  in thinking about a general purpose solution, one question is, can you keep the base filenames the same?
if so then a good general purpose solution might be an app that scans a directory and sets the file date stamps for all sets of files with same basename (and different extensions) to the date of earliest datestamp in the set.
Sorry, I didn't notice this response before. I don't see why you couldn't constrain most conversion apps to work in that way, and it occurs to me that a general purpose app that took that approach might be useful for all sorts of things where you might want the creation date to be retained in a different file format. Photos as well as audio -- maybe even MORE than audio, since I suspect my idiosyncratic approach to podcasts may not be "normal."  :)
-- bests, Tim

...this space unintentionally left blank.

oblivion

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 495
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #7 on: March 23, 2011, 05:58 AM »
Here's a proof-of-concept script. 

Thanks!

It doesn't seem to want to work, though. The script is in the freac app directory (\portableapps\freacportable\app\freac) and freaccmd.exe is present in the same place. I can drop an m4a onto it and it does the "converting" thing for a little while then stops, but I can't find any sign of the output file in the folder I specified (g:\temp) or, indeed, anywhere else.

Any idea what might be going wrong, or how I can watch what it's doing in more detail, perhaps?
-- bests, Tim

...this space unintentionally left blank.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,287
    • View Profile
    • Donate to Member
Re: Podcast Conversion and dates
« Reply #8 on: March 23, 2011, 12:16 PM »
Any idea what might be going wrong, or how I can watch what it's doing in more detail, perhaps?

On line 43, you can take off the "Hide" keyword.  This will allow you to see the freaccmd.exe window.