MP3-Downloader
Youtube to MP3 Coverter app
π· Previews
Download apk
π Tech Stacks & Open Source Libraries
- Jetpack Compose
- ViewModel
- Hilt
- Moshi
- Chaquopy : To create an environment to run .py script
- mobile-ffmpeg : To convert .m4a to mp3
- yt-dlp : To download .m4a audio from youtube
β Key features
- Grabbing & Downloading : Chaquopy used to create an environment for running main.py.
It contains
get_video_info()
to grab video info anddownload_audio()
to download m4a audio. During download, it also returns invokes a callback to log progress on Android side. - Converting Ffmpeg command to convert file
ffmpeg -i $inputFile -c:v copy -c:a libmp3lame -q:a 4 $outputFile
- Saving: Input and output streams used
π€ Key challenges faced
-
UI related β Creating multiple screens vs single screen β Architecturing the UI for different steps πͺ Solution: Broke down the UI into state machine. During a session, the app is always in one of the following
HomeScreenStep
-
yt-dlp related β How to use yt-dlp (python) in Android project β Understanding yt-dlp and creating script for it β How to send progress of download to Android πͺ Solution: Used Chaquopy and yt-dlp’s doc
-
ffmpeg related β How to use ffmpeg in Android project β Ffmpeg command to convert file πͺ Solution: Used mobile-ffmpeg and ffmpeg’s doc
β Possible Improvements
- Could have added tests
- Could have polished the UI
File structure
Click me
MP3 Downloader
β AndroidManifest.xml
β
ββββjava
β ββββcom
β ββββexample
β ββββmp3downloader
β β App.kt
β β MainActivity.kt
β β
β ββββdata
β β ββββmodel
β β DownloadProgressInfo.kt
β β VideoInfo.kt
β β
β ββββdi
β β AppModule.kt
β β
β ββββpresentation
β β ββββcommon
β β β β DestinationFolderItem.kt
β β β β DownloadButton.kt
β β β β ScreenHeader.kt
β β β β TextFieldItem.kt
β β β β VideoInfoItem.kt
β β β β
β β β ββββstep_content
β β β ConvertingStepContent.kt
β β β DownloadingStepContent.kt
β β β FailureStepContent.kt
β β β SavingStepContent.kt
β β β SuccessStepContent.kt
β β β
β β ββββhome_screen
β β HomeScreen.kt
β β HomeScreenEvents.kt
β β HomeScreenState.kt
β β HomeViewModel.kt
β β
β ββββui
β ββββtheme
β Color.kt
β Theme.kt
β Type.kt
β
ββββpython
β main.py
β
ββββres
ββββdrawable
β ic_launcher_background.xml
β yt_logo.png
β
ββββdrawable-v24
β ic_launcher_foreground.xml
β
ββββfont
β plus_jakarta_sans_bold.ttf
β plus_jakarta_sans_semibold.ttf
β
ββββmipmap-anydpi-v26
β ic_launcher.xml
β ic_launcher_round.xml
β
ββββmipmap-hdpi
β ic_launcher.webp
β ic_launcher_round.webp
β
ββββmipmap-mdpi
β ic_launcher.webp
β ic_launcher_round.webp
β
ββββmipmap-xhdpi
β ic_launcher.webp
β ic_launcher_round.webp
β
ββββmipmap-xxhdpi
β ic_launcher.webp
β ic_launcher_round.webp
β
ββββmipmap-xxxhdpi
β ic_launcher.webp
β ic_launcher_round.webp
β
ββββvalues
β colors.xml
β strings.xml
β themes.xml
β
ββββxml
backup_rules.xml
data_extraction_rules.xml