Mp3 to M3U8 audio file bitrate and quality transformation.
I want to create an m3u8 file from my node api. Though it converts the extension type and i can easily play it on any m3u8 player. But it fails to perform other transformations like bitrates. I think cloudinary does not support adaptive streaming for audio only files, so i am creating 3 transformations with different bitrates. Then i create a custom m3u8 file pointing to the response urls. But all of them have same audio quality and bitrates.
const uploadOptions: UploadApiOptions = {
access_mode: 'public',
unique_filename: true,
folder: fileInfo.folder,
public_id: publicId,
eager_async: eagerOption,
resource_type:'auto',
eager: [
{ bit_rate: "128k", quality: 40, format: 'm3u8' },
{bit_rate:'64k',quality:60,format:'m3u8'},
{ bit_rate: "192k", quality: 80, format: 'm3u8' }, ],
eager_notification_url: process.env.EAGER_URL,
};
this is how i build the new file
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=32000
— url —
#EXT-X-STREAM-INF:BANDWIDTH=128000
— url —
#EXT-X-STREAM-INF:BANDWIDTH=192000
— url —
Comments
-
i need support on this please.
0 -
Hi @sufian ,
Thanks for reaching out.
Can you please send us the delivery URL of you eager call and also a sample m3u8 file you are testing?
If you don't want to share this publicly, you can raise a request via https://support.cloudinary.com/hc/en-us/requests/new.
Kind Regards,
Thomas
0 -
@Tom thanks tom for replying to my request. It has been so long because i had done a workaround and forgot about the problem itself. So what i did was changing the audio frequency, it drastically reduced the chunk size and i know this might not be possible, under normal circumstances. It ain't the right solution but i had to do other works. Here is a file that i am currently using:
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:BANDWIDTH=128000
https://res.cloudinary.com/dc2ul0cal/video/upload/ac_aac,af_22050,f_m3u8/v1716523404/media/664ff6501509b18bfee0b43f/music/audio/c0323b5c-fc3f-4112-b954-fe1c06d539fc.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=192000
https://res.cloudinary.com/dc2ul0cal/video/upload/ac_aac,af_32000,f_m3u8/v1716523404/media/664ff6501509b18bfee0b43f/music/audio/c0323b5c-fc3f-4112-b954-fe1c06d539fc.m3u8
#EXT-X-STREAM-INF:BANDWIDTH=256000
https://res.cloudinary.com/dc2ul0cal/video/upload/ac_aac,f_m3u8/v1716523404/media/664ff6501509b18bfee0b43f/music/audio/c0323b5c-fc3f-4112-b954-fe1c06d539fc.m3u8Also i did another workaround. I first converted file to 3 different bitrates using cloudinary eager, then upload those files while converting them to m3u8 eagerly. Then create a custom final m3u8 playlist with links from those different bitrate files. It worked with bitrates, i could hear the difference but the duration or sample size didn't change. Like if it was 70kbs for one chunk in 128kbps, same will be for 64kbps while the original file size may decrease. But it beat what we wanted anyway.
And i lost previous files. But it generated links something like this in accordance to code in first question :
#EXTM3U
#EXT-X-VERSION:3
EXT-X-STREAM-INF:BANDWIDTH=64000
https://res.cloudinary.com/dc2ul0cal/video/upload/br_64,q_70,f_m3u8/v1715081209/media/660189a91e62413f8a96d2e6/music/audio/fc9c9ae1-eb71-4a41-9e39-af3e2998866a.m3u8
EXT-X-STREAM-INF:BANDWIDTH=128000
https://res.cloudinary.com/dc2ul0cal/video/upload/br_128,q_80,f_m3u8/v1715081209/media/660189a91e62413f8a96d2e6/music/audio/fc9c9ae1-eb71-4a41-9e39-af3e2998866a.m3u8
Instead i would like you to answer me clearly,
Is it possible to create m3u8 audio files with different bitrates using eager settings in node sdk?
I can use ffmpeg but it would require a lot of power for our new music app. We were thinking about shifting to aws if things get worse.0 -
Hi @sufian ,
Thanks for waiting.
So it is possible to create audio-only m3u8 streams as per
after which you would then create your own master playlist.However, due to a bug the bit_rate transformation does not get applied to the audio, this is only affecting when converting audio to HLS.
I have raised an internal bug for this so I will keep you posted on its update but I do not have any ETA currently.
Please let me know if you need anything else.
Kind Regards,
Thomas
1