-
Notifications
You must be signed in to change notification settings - Fork 6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting stream sample format #6235
Comments
This issue does not seem to follow the issue template. Make sure you provide all the required information. |
On the extraction side I'm afraid we don't expose the audio bit depth for compressed audio formats (only for uncompressed/PCM audio where it's stored in I'm a bit surprised this information is needed as I think generally audio decoders will either output in an encoding depending on the content (and allow you to query what this is), or allow you to set an output encoding and resample internally, so maybe I have misunderstood what you're trying to do. There are separate MIME types for DTS and DTS-HD, but there's a current limitation where for |
Thanks. I am expanding the ffmpeg extension so that it can transcode to AC3 (or anything else but given I have a Sonos system, AC3 is what I need) instead of just PCM. It makes a huge difference in terms of sound quality. Not being an expert, but setting the sample_fmt in this case seems not as simple as in the PCM case ( Maybe my transcoding engine is the culprit but it is based on https://ffmpeg.org/doxygen/4.1/transcode_aac_8c-example.html where basically the Anyway having inspected the MKV headers using mkvtoolnix I realize this information is not even available there so there is probably not much that can be done here. Maybe I could try and write a custom extractor based on FFmpeg and therefore get that information and store it in About the DTS/DTS-HD, I also saw that my video file had Thanks |
In this setup, I'm not sure where the format information is missing -- can't you set up the extension always to decode to 16-bit PCM (or float if you prefer, though I think this won't much much difference to quality given that AC-3 decodes to 16-bit PCM anyway), then add in your encoding step to AC-3 after that, where the input format is known? Sounds like a fun/useful project! |
Yes that was my initial take at it but then trying several different input codecs (DTS, DTS-HD, TrueHD, Dolby Digital Plus...) I could not get a consistent transcoding (crashes, no sound, static...). When I started using To be honest I do not understand why this info is not required when resampling to PCM but is when resampling to AC3: this is beyond my current comprehension 😀 So the question is: is writing a custom extractor tough or "straightforward"? Thanks |
Going on the assumption that the current code in the ffmpeg extension correctly resamples to 16-bit or float PCM (as requested by the Java layer), can't you just keep the resampling step and set up your encoder after that? Then it should always be getting input in one of those two formats. I think it's better to figure out what's going wrong in the ffmpeg wrapping code rather than implementing a custom extractor, which I wouldn't describe as straightforward. |
OK will look into that as I agree: there must be something. I will also try to auto-select the sample_fmt from the sample_fmts array: there is surely a way to find the "best" one automatically. Will keep you updated! |
I'll close this as at this point it is more related to ffmpeg than ExoPlayer, but feel free to post your findings if you discover what's going on before the issue is automatically locked. Thanks. |
So after more digging:
So I am stuck and require the Thanks for the discussion @andrewlewis! |
I'm still wondering whether it would work to keep a resampling step from whatever the decoder outputs to float planar in between the decoder and AC-3 encoder. It seems that would be the simplest solution. |
That’s what I am doing. Basically:
I understand that you say that I should be able to do it the same way as PCM decoding but I tried every combination and could not get consistent results unless I set My guess is that simply decoding to PCM and then feeding that to AudioSink is simpler than encoding to AC3. I guess also that the FFmpeg transcoding sample would not set I will do one last thing: tweak the FFmpeg transcoding sample to make it similar to how we think it should work and see if I get something. |
Another day, another fail 😅 Tried to get the |
Adding more suff if anybody gets here 😀 Dumped this info from ffmpeg. There is clearly real simple rules that could be built from this data but this is definitely not enough to cover all sorts of codecs...
|
[REQUIRED] Searched documentation and issues
Looked into the source code and here but could not find the info.
[REQUIRED] Question
I am making good progress on my (ffmpeg based) transcoding engine but I realize that I need to have access to the Sample Format information (sample_fmt in ffmpeg or equivalent in ExoPlayer) of the stream to decode/resample it properly. The field can be shown using ffprobe but I think this info is attached to the stream which is not accessible.
Also the profile would also be neat to get in order to make a difference between DTS and DTS-HD although they are supported by the same codec and have the same mime-type.
[STREAM]
index=2
codec_name=dts
codec_long_name=DCA (DTS Coherent Acoustics)
profile=DTS-HD MA
codec_type=audio
sample_fmt=s32p
The text was updated successfully, but these errors were encountered: