---
title: 'Batch Convert Lossless Audio to MP3 on Windows 10 WSL using FFmpeg Script'
source: 'https://youtube.com/watch?v=ksjG6iky50w'
video_id: 'ksjG6iky50w'
date: 2026-06-16
duration_sec: 0
---

# Batch Convert Lossless Audio to MP3 on Windows 10 WSL using FFmpeg Script

> Source: [Batch Convert Lossless Audio to MP3 on Windows 10 WSL using FFmpeg Script](https://youtube.com/watch?v=ksjG6iky50w)

## Summary

This video tutorial demonstrates how to batch convert lossless audio files (FLAC, M4A) to MP3 format on Windows 10 using a bash shell script within Windows Services for Linux (WSL) and FFmpeg. The creator walks through setting up the environment, installing FFmpeg, creating and using the conversion script, and managing the encoding process.

### Key Points

- **Introduction to Lossless-to-MP3 Conversion** [0:00] — The video follows a previous one about ripping CDs to lossless audio. This tutorial focuses on converting that lossless audio to MP3 using a shell script, similar to a prior AAC conversion video.
- **Installation of WSL and FFmpeg** [0:32] — WSL (Windows Services for Linux) must be installed first. Then, from within the WSL terminal, FFmpeg is installed by running: `sudo apt install ffmpeg`.
- **Navigating to Music Folder and Creating Output Directory** [1:10] — Change directory (`cd`) to the music folder containing lossless files. Create a separate output directory for MP3s using `mkdir music_mp3` to preserve the original files.
- **Creating the Conversion Script** [1:51] — Use `nano convert_to_mp3.sh` to create the script. Paste code from the creator's website. The script uses `#!/bin/bash`, sets `-e` for error handling, cleans up directory paths, finds lossless files with `find`, loops through them, creates new directories, and runs FFmpeg with high-quality settings (libmp3lame codec, quality level `-q:a 2`, variable bitrate).
- **Making the Script Executable and Running It** [4:10] — Run `chmod +x convert_to_mp3.sh` to make it executable. Execute the script with source and destination directories: `./convert_to_mp3.sh music music_mp3`. Encoding starts and recreates the folder structure.
- **Handling Interruptions and Re-running** [5:16] — If interrupted (Ctrl+C), the last partially encoded file must be deleted manually because it will be corrupted. Re-running the script resumes where it left off for all previously unprocessed files.
- **Use Cases and Flexibility** [6:02] — The generated MP3 folder can be copied to USB drives for car stereos, TVs, or MP3 players. Lossless originals can be archived and reused later for other formats (e.g., AAC) or different quality levels.

### Conclusion

This tutorial provides a reliable method to batch convert lossless audio to MP3 on Windows 10 using WSL and FFmpeg, preserving file structures and enabling flexible reuse of lossless archives for various playback scenarios.

## Transcript

welcome in a previous video I talked
about ripping CDs to lossless audio
using Windows Media Player on Windows 10
in this video I'm going to be talking
about using a shell script to convert
lossless audio to mp3 format I did a
previous video to do the same thing with
AAC and this is going to be very similar
to that video so I have the music folder
on this computer with two albums in here
it has lossless audio on it and I'm
going to go and and you need to install
Windows services for Linux I have a
video on that I'll put that in the
description once you have that installed
you can execute a typing bash and this
will bring a shell up and we'll need the
ffmpeg software and I've done some
videos on that there's a couple
different ways to install it for this
video you need to install it from within
the windows services for Linux so you
would type sudo space app space install
space ffmpeg we'll hit enter it'll ask
for a password and I already have
installed but it would install here next
we'll navigate to the music folder or
the my home directory so I'll type CD
space dot forward slash dot forward
slash and that'll take me down to
directories then I'll type CD space
users with a capital u and then my
username which is Rick if I look in here
we'll see I have a music directory and
that has the lossless audio in it I can
type in mkdir space music underscore mp3
and this will create an mp3 directory
that we can store the mp3s in so what
this will do is this will retain the
lossless audio and it will create a new
folder with just the mp3's in it next we
can type in nano space convert to mp3
dot Sh and this doesn't have to be exact
but I'll do that that'll open up a text
editor go over to my website here and
I'll select all this code
I'll right-click and say copy and then I
will right-click in my editor and it
will paste that in there well look
through this real quick so this bin bash
just means it's a shell script the set e
is so when you hit ctrl C it will kill
the whole script otherwise it will just
kill the ffmpeg process that's running
and this just talks about usage here
these few lines are cleaning up the
directories you supply it to make sure
that the the trailing slashes are fixed
and the full path is used this fine
command finds all the slacker
m4a so this would be for flak and
lossless audio files and it passes those
to a loop so this loop will split apart
the name and directory and it will
create a new directory in the new folder
and it will create a new file name and
then it will look to see if the file has
been created before and if it hasn't it
will convert it using this ffmpeg script
so you have ffmpeg here high banner will
just hide like version information and
such - I will be the input so this is
the original file - C : a is the audio
codec and it will use lib mp3 lame and
then - Q : a is the quality so we're
going with - so it goes the lower
numbers are better quality so if you
want to one or zero you could
potentially get better quality but this
is considered very good quality so it's
probably not worth going lower on this
and this is variable bitrate - and you
can change these up if you want some
kind of different that format and then
we have the new file name here and this
is in quotes in case our spaces and then
we have less than slash dev slash null
and this keeps a standard input from
getting into ffmpeg and causing problems
so now I'll type ctrl o to save this out
and then ctrl X to exit and then before
we can run the script we need to type
chmod space plus x space and then
convert to mp3 dot Sh so this will make
it executable so now I should be able to
type dot slash
convert to mp3 Sh and you'll see it's
asking it's telling us how to use this
so to use it I'll type dot slash convert
to mp3 Sh I'll type the source directory
which was music and then the destination
directory which was music underscore mp3
and it doesn't matter if you have the
trailing slash or not so I'll hit enter
here and now it will start encoding this
to mp3 so if we click on our File
Explorer I'll click on my home directory
if we look in music mp3 you'll see we
have the taylor swift folder if we click
on it you'll see reputation and then in
here it's converting the files to mp3 so
it will recreate the file structure as
it encodes so if you hit ctrl C while
this is running it will stop the
execution
so then you'll want to go into your
music and find the last file it was
encoding looks like it was called don't
blame me and we'll click on this and
we'll delete it so this script if we run
it again it will start off where it was
last time but that when you stop it in
the middle of encoding a song it'll
screw up that song so we delete that one
song we run it and it will pick up where
it left off so what you could do with
this know is you'll have this music mp3
folder you could copy this over to a
thumb drive to stick in your car like
USB so you can play it off your car
stereo you can stick it in an audio
receiver the back of the TV you could
move it to an mp3 player you can do it
with it whatever you want and then you
could take your lossless audio if you
want and you could move it to a USB
Drive a thumb drive a large SD card and
take it off your computer and then
someday if you want to reload to a
different format you could stick it back
in and then run a script like this again
like if you want to go with a cc or
change the quality level or
whatever or if you had a small mp3
player you want to take jogging with you
every day you could encode to a smaller
format so maybe the quality isn't as
good but you could put more songs on
your player by running this script so so
that's the basics of using the bash
script to convert lossless audio to mp3
if you have any questions please leave
them in the comments if you like this
video please click like if you haven't
subscribed my channel or appreciate if
you do that and thanks for watching
until next time goodbye
