googlearchive / android-Camera2Video

Migrated:
https://github.com/android/camera
Apache License 2.0
1.21k stars 568 forks source link

the video that is recorded with this sample app doesn't play with exoplayer #92

Closed fahime-ghasemi closed 5 years ago

fahime-ghasemi commented 6 years ago

I added a fragment to sample app that has an ExoPlayer to play video that is recorded. At the end of stopRecordingVideo method, I passed the mNextVideoAbsolutePath variable to a new fragment to play it in exoplayer. but I got the following error.

2018-11-05 18:22:55.538 6128-6830/com.example.android.camera2video E/LoadTask: Unexpected exception loading stream java.lang.IllegalStateException: Top bit not zero: -696383949 at com.google.android.exoplayer2.util.ParsableByteArray.readUnsignedIntToInt(ParsableByteArray.java:389) at com.google.android.exoplayer2.extractor.mp4.AtomParsers.parseStbl(AtomParsers.java:174) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.getTrackSampleTables(Mp4Extractor.java:455) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processMoovAtom(Mp4Extractor.java:390) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.processAtomEnded(Mp4Extractor.java:358) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.readAtomPayload(Mp4Extractor.java:349) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:180) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:898) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:379) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:762)

2018-11-05 18:22:58.550 6128-6829/com.example.android.camera2video E/ExoPlayerImplInternal: Source error. java.io.EOFException at com.google.android.exoplayer2.extractor.DefaultExtractorInput.readFromDataSource(DefaultExtractorInput.java:265) at com.google.android.exoplayer2.extractor.DefaultExtractorInput.readFully(DefaultExtractorInput.java:72) at com.google.android.exoplayer2.extractor.DefaultExtractorInput.readFully(DefaultExtractorInput.java:81) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.readAtomPayload(Mp4Extractor.java:334) at com.google.android.exoplayer2.extractor.mp4.Mp4Extractor.read(Mp4Extractor.java:180) at com.google.android.exoplayer2.source.ExtractorMediaPeriod$ExtractingLoadable.load(ExtractorMediaPeriod.java:898) at com.google.android.exoplayer2.upstream.Loader$LoadTask.run(Loader.java:379) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:762)

mohanrajsambath commented 5 years ago

I've also faced this issue, I resolved this by maximum resolution of media recorder is 1080x720p, please maintain this ratio for recording, here is the method I customized for my requirement, hope it will help you.

/To maintain the aspect ratio 16:9 for record video/ /*

codingjeremy commented 5 years ago

This sample has been migrated to a new location (check README for more information).

As recommended by GitHub, we are closing all issues and pull requests now that this older repo will be archived.

If you still see this issue in the updated repo, please reopen the issue/PR there. Thank you!