-
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
How to Switching between audio tracks of MPG file in exoplayer V2? #4406
Comments
Switching tracks works the same for all file types and formats. Can you explain in more detail what you did for MP4 and why the same doesn't work for MPG? |
Version:ExoPlayer V2 2.8.1 This is a music video in mpeg2 format, I use the Android 6.0 SDK's android.media.MediaExtractor class to read all the track information and get the following tracks: 1、{height=1080, width=1920, mime=video/mpeg2, durationUs=265831733, csd-0=java.nio.ByteArrayBuffer[position=0,limit=22,capacity=22], slice-height=1080, stride=1920} For the same MPG file, useing EXOPlayer V2 to get all the track information, as follows: EventLogger: tracksChanged [0.93, 0.00, window=0, period=0, Another MKV format file,useing EXOPlayer V2 to get all the track information, as follows: EventLogger: tracksChanged [0.26, 0.00, window=0, period=0, |
@tonihei Thanks a lot for your answers. I use MediaInfo software to read the file format information as follows: General Video Audio #1 Audio #2 |
I use DEMO to test, without modifying any code, only modify the media.exolist.json file in the assets directory, just add two video addresses, as follows: |
There are two problems with playing MPG video: I tried to track the code that reads the track information and found that this class (com.google.android.exoplayer2.extractor.ts.PsExtractor) reads it。 public final class PsExtractor implements Extractor {
public int read(ExtractorInput input, PositionHolder seekPosition) throws IOException, InterruptedException { But I haven't guessed why the author did this , and How to modify it so that it can read all audio track information? |
Thanks. I understand your problem now and that looks indeed like a bug. Can you send us the example file which causes the problems? If you don't want to post it publicly, feel free to send an email to dev.exoplayer@gmail.com with "Issue #4406" in the subject. |
@tonihei Thanks a lot for your answers. I have sent the file that caused the problem to dev.exoplayer@gmail.com, please check!! |
Thanks, I can reproduce the problem and we will provide a fix for this soon. |
Currently we immediately stop searching after we found one video and one audio track. This change adds some leeway to detect additional tracks. Issue:#4406 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=202455491
@tonihei Thanks a lot for your kind help! this bug has been fixed,But still there are two problems: Still that same MPG file,There are two problems with playing MPG video: I use the Android 6.0 SDK's android.media.MediaExtractor class to read all the track information, each track, The durationUs is 265831733: 1、{height=1080, width=1920, mime=video/mpeg2, durationUs=265831733, csd-0=java.nio.ByteArrayBuffer[position=0,limit=22,capacity=22], slice-height=1080, stride=1920} |
What's wrong with the duration? It's about 4 minutes and 25 seconds - the same as shown by the media info software you used above . |
@tonihei Thanks a lot for your answers. The problem is : Also I can get the real data if I using the android.media.MediaExtractor class under Android 6.0 SDK. So as above desc , I just want to get your help for how to get the Duration Time of MPG file in EXO . BR, |
See here for why PS streams are currently not seekable. @botaydotcom is currently looking at determining stream duration + enabling seeking for non-seek-friendly formats, so we might be able to fix this fairly soon. |
Closing because the bug is solved and I think @ojw28 kindly answered your follow up question. |
Currently we immediately stop searching after we found one video and one audio track. This change adds some leeway to detect additional tracks. Issue:#4406 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=202455491
I using exoplayer V2 in our project, and i have a issue as bellow:
How to Switching between audio tracks of MPG file in exoplayer V2?
Yes, I can switch audio tracks on MP4/MKV but MPG.
Cloud anyone let me know the key point or other ?
The text was updated successfully, but these errors were encountered: