

The user plugs their SD card into a laptop provides the base input directory and algorithm will recursively traverse the directory structure converting all *.m4a files to *.mp3. So to be able to play this music I wrote a tool to convert *.m4a audio files to *.mp3.

I suppose this is technology from 2012 (as automotive has a 3 to 4 lag time on this kind of technology) Strangely, the VW infotainment systems (from 2016/17) only support mp3 files. However, only a few albums were mp3, most where m4a. Tool Description For longer than I care to admit I have had a 16GB SD card plugged into my infotainment system full of music.

Not the typical systems application that Rust was designed for but shows that Rust, Cargo and Rustup are very quick and handy to use. This tool is a wrapper for ffmpeg, of which I thought I would use Rust to do the directory navigation. It turns the answer is quick, simple and easy. The ffmpeg code that I'm using does work (I can encode individual file) but I haven't figured out how to batch encode the entire directory.Sorry for the confusing title, but this was actually an exercise to see how quickly I could write a tool in Rust to perform a function that would typically be driven by a bash script. It's giving me an "invalid argument" error message when I run it - probably because I haven't specified the names correctly(?)

I've used the suggested code from this question ( ) But, I don't know how to capture the original file names (with spaces and punctuation) and use that as the new file name in the new directory.įfmpeg -i “$i” -vf "scale='if(gt(a*sar,16/9),640,-1)':'if(gt(a*sar,16/9),-1,360)',pad=640:360:(ow-iw)/2:(oh-ih)/2,setsar=1" -vcodec libx264 -b:v 1600k -bufsize:v 1600k -r 30000/1001 “encoded/$name.mp4” I'm trying to batch encode 45 video files, and copy the encoded files into an existing subfolder called "encode"
