Skip to content
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

H264 TS video not seekable in exoplayer #6894

Closed
waqasyousafy opened this issue Jan 21, 2020 · 13 comments
Closed

H264 TS video not seekable in exoplayer #6894

waqasyousafy opened this issue Jan 21, 2020 · 13 comments
Assignees

Comments

@waqasyousafy
Copy link

waqasyousafy commented Jan 21, 2020

I am playing the .mp4 h264 video in exoplayer with defaultExtractor. Video is not seekable. When i seek the video it goes to start everytime i want to seek it. Others MP4 videos plays fine without any issue . Help me I am beginner of exoplayer . Frame rate is 25. I am playing the video offline.

@icbaker
Copy link
Collaborator

icbaker commented Jan 21, 2020

We need more information to be able to help. Please fill in the issue template (copy-paste it here, and fill in every section).

Does this reproduce in the ExoPlayer demo app?

Can you provide test content that demonstrates the issue? Either upload it here or email it to dev.exoplayer@gmail.com with subject "Issue #6894".

@andrewlewis
Copy link
Collaborator

Potentially relevant: fragmented MP4 files without sidx boxes are not seekable (see the later replies on #6605 for more details).

@waqasyousafy
Copy link
Author

#andrewlewis thanks for your suggestion but i am still confused between the these two concepts.one you have told me and second one is moov atom to be replaced at the begining of the videos . Please clear it to what it should be??

@andrewlewis
Copy link
Collaborator

andrewlewis commented Jan 24, 2020

@waqasyousafy It would be easiest to help if you could share the media with us so we can try to determine exactly what's wrong with it (rather than speculating on what might be wrong).

It is best practice to put header data at the start of the stream so the player doesn't need to request header data from the end of the stream. For fragmented MP4 streams we need a sidx box to make them seekable (this does not apply to unfragmented MP4s).

@waqasyousafy
Copy link
Author

@andrewlewis Sorry for late replying . Here is the video link i am using in playing :
https://drive.google.com/open?id=16CJJKU-p6Dwd3WBi8KaVuBJn1y8Os7qi

@icbaker
Copy link
Collaborator

icbaker commented Jan 27, 2020

Thanks for the media - although the provided file has a .mp4 extension, it's actually an MPEG-TS file, not MP4:

$ mediainfo matchvideo.mp4
General
ID                                       : 1 (0x1)
Complete name                            : matchvideo.mp4
Format                                   : MPEG-TS
File size                                : 11.4 MiB
Duration                                 : 1 min 9 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 344 kb/s
FileExtension_Invalid                    : ts m2t m2s m4t m4s tmf ts tp trp ty

I don't see exactly the behaviour you describe - when I play this file in the demo app there seek bar is completely disabled (rather than allowing seeking, but always returning to the beginning) - are you seeking programmatically without checking whether ExoPlayer thinks the media is seekable? That might cause the 'return to start' behaviour.

The file is not seekable due to constraints in ExoPlayer's handling of MPEG-TS streams. This is tracked in #5097. As a workaround you can increase the value of TsDurationReader#TIMESTAMP_SEARCH_BYTES - I tried this locally and your video became seekable.

@icbaker icbaker closed this as completed Jan 27, 2020
@icbaker icbaker changed the title H264 mp4 video not seekable in exoplayer H264 TS video not seekable in exoplayer Jan 27, 2020
@waqasyousafy
Copy link
Author

@icbaker thank you but i did not figure it out how to use it . I have searched a lot but not find any solution yet can you please refer me some example if you agree . I will be grateful to you .

@icbaker
Copy link
Collaborator

icbaker commented Jan 27, 2020

You will have to fork ExoPlayer and change the value yourself locally, then amend your gradle config to depend on your locally-compiled version rather than the one provided via jcenter.

This is the line you need to change:

private static final int TIMESTAMP_SEARCH_BYTES = 600 * TsExtractor.TS_PACKET_SIZE;

There's some general gradle advice about depending on a local jar here:
https://stackoverflow.com/questions/20700053/how-to-add-local-jar-file-dependency-to-build-gradle-file

@waqasyousafy
Copy link
Author

Thank you so much @icbaker . It solved my problem . You know its my first project in android . I am very happy to complete this . Thank you for help

@waqasyousafy

This comment has been minimized.

@waqasyousafy

This comment has been minimized.

@icbaker

This comment has been minimized.

@icbaker

This comment has been minimized.

@google google locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants