Close

Batch File Conversion and Renaming

A project log for Zoom F1 Field Recorder as MP3 Player

Unable to find a proper simple, durable portable music player, I've decided to use my Zoom F1

DustinDustin 01/01/2022 at 19:050 Comments

To get this working right away, I took an album of mp3 files and simply renamed them using Krename. This got the proof of concept working right away and I've been listening to it and working on a better way to prepare files for the Zoom. This involves two steps. The first is to convert the file to an MP3 format, if it isn't already. I have wav, wma, and flac files among the various mp3 files. I started by just making a folder with all the songs I wanted on the the device. I then searched all files using "*.*", which showed all files. I selected all and copied them into another folder. Then I removed all files that weren't audio files. This left me with just the audio files in a folder. I used a Linux script to search for wma, wav and flac files with ffmpeg, and convert them to 320Kbps mp3 files. I'll share the script code here and in the "Files" section of the main project page. I may start a GitHub page for it and refine it as I go. This is running in a terminal window now. I'm using an overclocked Raspberry Pi 400 running Pop!_OS, but this would go much faster on a more powerful machine.

The next step, after file conversion, is to batch rename the files into a format the Zoom can handle. It looks like this: ZOOM0001.MP3. I will use Krename to batch rename these, add the numbers automatically, and change the extension to uppercase.

After that is done, it's a simple matter of copying the converted and renamed files to the SD card and putting it into the Zoom to enjoy my music.

This process is not very pretty, but it does work. The script currently only finds files in the directory it is located and needs to be started from a terminal window using the "bash" command. It is working just fine and I have gotten working audio files out of it already. It also dumps the converted files into the source directory. This isn't a huge problem as I can just search for ".MP3", select all, and copy those to the SD card, ignoring all invalid files.

If testing goes well and I decide to stick with the Zoom F1 as my main media player, I will refine the software and make it far more user friendly. I know of someone who has a Zoom F1 and might really enjoy this project. He runs a business collecting interesting sounds from all over the world. I'll write the code and documentation with him in mind, and ask if he would like to test it out for me and report back. If not, I'll still end up with a nicely polished program that soles a real problem for me and anyone else who might be interested.

Here is the initial code. Crude, but effective:

#!/bin/bash
source = /home/dustin/Music/Zoom_All_Sorted

for f in *.wav; do
    ffmpeg -i "$f" -c:a libmp3lame -b:a 320k \
    "${f/%wav/mp3}";
done
    
for f in *.wma; do
    ffmpeg -i "$f" -c:a libmp3lame -b:a 320k \
    "${f/%wma/mp3}";
done
    
for f in *.flac; do
    ffmpeg -i "$f" -c:a libmp3lame -b:a 320k \
    "${f/%flac/mp3}";
done 

I would like to rewrite the entire thing in Python and make it cross platform compatible. I only use Linux, but I know many people use various other operating systems. This is a fairly simple program, but I want to add a few advanced features, such as being able to shuffle the playlist. This would require randomly reordering the files, then renaming them. This should be fairly simple, but very useful to change up a playlist. I'd like to make a program that manages entire audio libraries for the Zoom, but this might take a while. I made this as fast as possible so I can get this working and ready for work on Monday.

The program just finished running and converted 113 files for me. Doing this by hand would have been a nightmare. I tried using VLC to batch convert the files. It ran, but left empty files. This method using ffmpeg seems to have worked just fine.

Renaming the files now and testing. There are 1,518 files to rename here. Krename would not add them all when using the open dialog box, but worked when dragging and dropping the files in. Odd, but it is running now. I'm copying the files to a new directory as they are renamed, instead of renaming the source files. This is to allow me to modify the original playlist by adding or removing songs, then just batch renaming them again and overwriting the SD card. Otherwise, I'd have no idea of the file names, outside of the Zoom names.

File rename operation completed successfully. Waiting on almost 15GB of audio files to copy to the SD card for testing. I'm not sure how it will handle so many files. If all goes well it will recognize them all and play. If so, I will skip backwards to the last file to make sure it can handle the 4 digit file names. Surprisingly, the Pi 400 laptop has not crashed once, even under load and after many file operations. It's very unreliable these days. I suspect it's the SSD being old and sucking down massive amounts of power from the USB port. I also have an electric heater that dims the lights. I saw the ow voltage symbol earlier. I plan to get a super tiny 1TB USB 3 SSD to boot from in the future. Until then I have to hope t doesn't lock up while working. Still waiting on the files to copy. SD cards are among my least favorite storage media these days.

After adding 1,518 audio files, I found that it will only see 500 at a time by default. It creates "FOLDER01" automatically, and this is where I put the files. I tried creating other folders like "FOLDER02" and adding other files to those, but it will not see them. I'm not sure if this device actually supports multiple folders like the Zoom H5 does. This is an annoying limitation, but I could live with it if needed. I'll just have to choose my songs more carefully. Another option is to combine all tracks into one gigantic 15GB audio file and drop that on there. This would take away the ability to skip individual tracks, which I really enjoy. I wouldn't be surprised if I was the only person to try this and discover this limitation. I'll do some research on file limitations, and contact Zoom if I can't ind anything. I'm curios as to what they'd say about this little project. Even with the 500 file limitation, I am enjoying using it as an audio player so far.

Google isn't turning up anything remotely useful, outside of the user manual, which won't load because the internet where I'm at is entirely useful. I can't even open a web page. I'll work on this later and just enjoy the rest of my day off.

Discussions