Closed Shabinder closed 3 years ago
I got the solution. If you have installed ffmpeg or ffmpeg-python. Uninstall it. As it will not work Run this command
pip uninstall ffmpeg pip uninstall ffmpeg-python
Now go to this link https://ffmpeg.zeranoe.com/builds/
Download ffmpeg from here and Install it in C:\ffmpeg Then go to Environment Variables and in Path add a new path as - C:\ffmpeg\bin As this path contains ffmpeg.exe And That's it
Now suppose you have TEST.m4a file that you want to convert to TEST.mp3 Simply Copy and Paste the file name and run the below script. Note: The bewlo .py file should be in the same directory as TEST.m4a or otherwise you will need to add the correct path in 'CurrentFileName' variable Now Simply Create a .py File and paste this code
import subprocess
CurrentFileName = 'TEST.m4a'
FinalFileName = 'TEST.mp3'
try:
subprocess.call(['ffmpeg', '-i', f'{CurrentFileName}', f'{FinalFileName}'])
except Exception as e:
print(e)
print('Error While Converting Audio')
ch = input('Press Enter to Close')
This worked Perfectly for me as I wanted. :) If I was not clear in the answer do let me know here or you can mail me - kartikamit171@gmail.com
@AvTe Thanks for posting such an elaborate answer , but as I said in my issue , I dont wanna use FFmpeg!
I was hoping of there is any source of mp3 direct from jioSaavn , as I guess, earlier lib used to give mp3 links if I am not wrong.
However , if there isnt any solution only then I will use ffmpeg.
Hey @Shabinder As you mentioned that you need a mp3 directly from saavn, there is a way to get mp3 but all songs aren't available. That's why I switched to m4a which is served by JioSaavn by default. In case you need mp3 (Media URLs may not work) you can check out previous versions of the API or you can check https://h.saavncdn and rename .mp4 to .mp3
For eg: If you try searching Alone by Alan Walker you'll get this media_url
https://aac.saavncdn.com/522/cc62bd3e274e8d8b1a54c27c70ada512_320.mp4
This is the standard m4a quality that you're getting If you need mp3 the above link will change to
https://h.saavncdn.com/522/cc62bd3e274e8d8b1a54c27c70ada512_320.mp3
As this doesn't work in 10/10 cases, previously I used to check if the song is available in mp3 quality or not and then send response but that made the API hell lot slower. So I decided to switch to m4a which is better than mp3 too.
Hope this helps 😄
Ohhkay.
Hey, for my use case I need mp3s and It seems this library only give mp4/m4a files link.
I don't want to use FFmpeg locally to convert the file from m4a to mp3, So by any chance saavn gives mp3 link too?