1
votes

i have a video player fragment to play a video using video view and mediaplayer. i have videos recorded with a camera. I am transcoding the videos from flv flavor to mp4 flavor so that i can run them on my mobile application. i checked my application to play an mp4 video (sample video) and it is playing perfectly but when i transcode an flv video to mp4, the mp4 version runs on browser and VLC media player as well but not in my android application. It shows wrong length of the video (shows length of video as 87.15 minutes for a 2 minute video) i see the seeker moving but again see nothing in player and neither hear any sound. Below are the ffmpeg information of the video prior to transcoding and post to transcoding and the error log.i can see the error MediaPlayer﹕ error (1, -2147483648) being raised. i checked the error on stackoverflow and the MOOV atom is in place as suggested by google.

Please help.......

ffmpeg information before transcoding

Input #0, flv, from '03c82713-f369-462c-b59a-   777a98fb12cc1435052031199':
Metadata:
encoder         : Lavf56.25.101
Duration: 00:03:54.57, start: 0.000000, bitrate: 211 kb/s
Stream #0:0: Video: h264 (High), yuv420p, 688x360, 1000 kb/s, 30.30   fps, 30 tbr, 1k tbn, 60 tbc
Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s

ffmpeg information after transcoding

 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'eb7e2f00-c61f-4308-8c86-   222868c03c131435746544880.mp4':
 Metadata:
major_brand     : isom
minor_version   : 512
compatible_brands: isomiso2avc1mp41
encoder         : Lavf56.25.101
Duration: 00:01:15.55, start: 0.036281, bitrate: 344 kb/s
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
  handler_name    : SoundHandler
Stream #0:1(und): Video: h264 (High 10) (avc1 / 0x31637661), yuv420p10le, 426x240, 208 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
  handler_name    : VideoHandler

Error stack trace

07-01 19:46:26.501  22067-22067/com.project.test1.android     E/MediaPlayer﹕ Should have subtitle controller already set
 07-01 19:46:26.785  22067-22160/com.project.test1.android      E/MediaPlayer﹕ error (1, -2147483648)
07-01 19:46:26.791  22067-22067/com.project.test1.android     E/MediaPlayer﹕ Error (1,-2147483648)
07-01 19:46:31.651  22067-22067/com.project.test1.android E/MediaPlayer﹕ Attempt to call getDuration without a valid mediaplayer
07-0    1 19:46:31.651  22067-22067/com.project.test1.android E/MediaPlayer﹕ error (-38, 0)
07-01 19:46:31.662  22067-22067/com.project.test1.android E/MediaPlayer﹕ Error (-38,0)
07-01 19:46:31.684  22067-22067/com.project.test1.android     E/MediaPlayer﹕ Attempt to call getDuration without a valid mediaplayer
 07-01 19:46:31.684  22067-22067/com.project.test1.android E/MediaPlayer﹕ error (-38, 0)
07-01 19:46:31.692  22067-22067/com.project.test1.android E/MediaPlayer﹕ Attempt to call getDuration without a valid mediaplayer
07-01 19:46:31.692  22067-22067/com.project.test1.android E/MediaPlayer﹕ error (-38, 0)
 07-01 19:46:31.708  22067-22067/com.project.test1.android E/MediaPlayer﹕ Error (-38,0)
 07-01 19:46:31.708  22067-22067/com.project.test1.android     E/MediaPlayer﹕ Error (-38,0)
1

1 Answers

0
votes

Troubleshooting video playback can be very frustrating, it often involves a lot of trial and error. The first place I'd recommend starting is by changing the transcoded video's H264 Profile. Currently, it is using the source profile of "High 10", however, most versions of Android only support H264 Baseline and Main Profile out-of-the-box (see Android's Supported Media Formats).

The syntax for specifying the profile in FFMPEG can be found here. A good place to start is the Baseline Level 3.0 Profile by adding -profile:v baseline -level 3.0 to your output parameters.