medooze / media-server-demo-node

Demo application for the Medooze Media Server for Node.js
MIT License
92 stars 48 forks source link

Best way to stream audio #22

Closed tomas-berg closed 6 years ago

tomas-berg commented 6 years ago

What is the best way to stream mp3 file?

murillo128 commented 6 years ago

convert it to opus and use an mp4 container

tomas-berg commented 6 years ago

@murillo128 thanks

tomas-berg commented 6 years ago

@murillo128 mp4 container can not contain opus codec. Can we use mkv instead?

murillo128 commented 6 years ago

yes, it does

https://opus-codec.org/docs/opus_in_isobmff.html

only mp4 is supported currently, sorry

El vie., 30 nov. 2018 8:35, Tomas Berg notifications@github.com escribió:

@murillo128 https://github.com/murillo128 mp4 container can not contain opus codec. Can we use mkv instead?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/medooze/media-server-demo-node/issues/22#issuecomment-443117441, or mute the thread https://github.com/notifications/unsubscribe-auth/ABBW8xrVCaW0WYepJygnBArM2tesYjnhks5u0N-sgaJpZM4Y5ozq .

tomas-berg commented 6 years ago

It's interesting then how to make it with ffmpeg ffmpeg -i input.opus -c:a opus -strict experimental output.mp4

throws Could not find tag for codec opus in stream

tomas-berg commented 6 years ago

MP4 doesn't support opus, but MP4v2 does. Need ffmpeg version 3.4 or above with -brand mp42 option

tomas-berg commented 6 years ago

Got on server side:

[0x7f08af493740][1543583418.922][LOG]>MP4 opening [./media/output.mp4] FindTrackId: Track index doesn't exist - track 0 type hint (../external/mp4v2/lib/src/mp4file.cpp,3002) [0x7f08af493740][1543583418.923][LOG]-Found hint track [hintId:0] FindTrackIndex: Track id 0 doesn't exist (../external/mp4v2/lib/src/mp4file.cpp,3016) FindTrackId: Track index doesn't exist - track 0 type text (../external/mp4v2/lib/src/mp4file.cpp,3002)

ffmpeg file info output:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4': Metadata: major_brand : mp42 minor_version : 512 compatible_brands: isomiso2mp41 encoder : Lavf58.20.100 Duration: 00:02:56.35, start: 0.000000, bitrate: 96 kb/s Stream #0:0(und): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 94 kb/s (default) Metadata: handler_name : SoundHandler