2017-04-30 65 views
1

我想播放TextureView上呈現的mp4視頻,它的API LEVEL> = 21(在Lollipop之後),但在以前的版本中它不播放。我在logcat中收到以下錯誤:error (1, -2147483648)。我認爲這是一個未知的錯誤(據我所知)。Android MediaPlayer沒有播放mp4視頻前棒棒糖

該文件從資產文件夾中加載。

表面的大小是:768x1280和視頻大小是:350x500像素。我也嘗試調整大小不同的視頻(創建新視頻):768x1280,1080x1920和4k。什麼導致了錯誤?縱橫比還是不同的設備/視頻分辨率?

我得到在logcat中以下消息同時得到準備的文件:

04-30 17:56:01.752 432-432/? V/FFmpegExtractor: SniffFFMPEG 
04-30 17:56:01.752 432-432/? I/FFmpegExtractor: android-source:0xb83b8e00 
04-30 17:56:01.752 432-432/? D/FFMPEG: android source begin open 
04-30 17:56:01.752 432-432/? D/FFMPEG: android open, url: android-source:0xb83b8e00 
04-30 17:56:01.752 432-432/? D/FFMPEG: ffmpeg open android data source success, source ptr: 0xb83b8e00 
04-30 17:56:01.752 432-432/? D/FFMPEG: android source open success 
04-30 17:56:01.800 432-432/? I/FFMPEG: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'android-source:0xb83b8e00': 
04-30 17:56:01.800 432-432/? I/FFMPEG: Metadata: 
04-30 17:56:01.800 432-432/? I/FFMPEG:  major_brand  : mp42 
04-30 17:56:01.800 432-432/? I/FFMPEG:  minor_version : 0 
04-30 17:56:01.800 432-432/? I/FFMPEG:  compatible_brands: mp42mp41 
04-30 17:56:01.800 432-432/? I/FFMPEG:  creation_time : 2017-04-30 21:22:53 
04-30 17:56:01.800 432-432/? I/FFMPEG: Duration: 00:00:29.50, start: 0.000000, bitrate: 2522 kb/s 
04-30 17:56:01.800 432-432/? I/FFMPEG:  Stream #0:0(eng): Video: h264 (Main) (avc1/0x31637661), yuv420p(tv, smpte170m), 350x500, 2517 kb/s, 30 fps, 30 tbr, 30k tbn, 60 tbc (default) 
04-30 17:56:01.800 432-432/? I/FFMPEG:  Metadata: 
04-30 17:56:01.800 432-432/? I/FFMPEG:  creation_time : 2017-04-30 21:22:53 
04-30 17:56:01.800 432-432/? I/FFMPEG:  handler_name : Alias Data Handler 
04-30 17:56:01.800 432-432/? I/FFmpegExtractor: FFmpegExtrator, url: android-source:0xb83b8e00, format_name: mov,mp4,m4a,3gp,3g2,mj2, format_long_name: QuickTime/MOV 
04-30 17:56:01.800 432-432/? I/FFmpegExtractor: list the formats suppoted by ffmpeg: 
04-30 17:56:01.800 432-432/? I/FFmpegExtractor: ======================================== 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[00]: mpeg 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[01]: mpegts 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[02]: mov,mp4,m4a,3gp,3g2,mj2 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[03]: matroska,webm 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[04]: asf 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[05]: rm 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[06]: flv 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[07]: swf 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[08]: avi 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[09]: ape 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[10]: dts 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[11]: flac 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[12]: ac3 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[13]: wav 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[14]: ogg 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[15]: vc1 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: format_names[16]: hevc 
04-30 17:56:01.800 432-432/? I/FFmpegExtractor: ======================================== 
04-30 17:56:01.800 432-432/? V/FFmpegExtractor: major_brand tag is:mp42 
04-30 17:56:01.800 432-432/? D/FFmpegExtractor: suppoted codec(h264) by official Stagefright 
04-30 17:56:01.800 432-432/? D/FFMPEG: android source close 
04-30 17:56:01.800 432-432/? I/FFmpegExtractor: sniff through BetterSniffFFMPEG success 
04-30 17:56:01.800 432-432/? D/FFmpegExtractor: ffmpeg detected media content as 'video/mp4' with confidence 0.08 
04-30 17:56:01.804 432-432/? I/SampleTable: There are reordered frames present. 
04-30 17:56:01.816 432-15591/? I/OMXCodec: [OMX.google.h264.decoder] AVC profile = 77 (Main), level = 31 
04-30 17:56:01.816 432-15591/? I/OMXCodec: [OMX.google.h264.decoder] video dimensions are 320 x 240 
04-30 17:56:01.816 432-15591/? I/OMXCodec: [OMX.google.h264.decoder] Crop rect is 320 x 240 @ (0, 0) 

視頻使用Adobe After Effects創建並保存爲.AVI文件,之後導入到Adobe Premier Pro,並出口到.mp4(H .264)

回答

0

它看起來像導出的文件沒有有效的配置文件。 listed media formats顯示爲唯一支持的配置文件是H.264的基準配置文件。

要添加的基準配置文件,您需要通過下載ffmpeg和創建使用下面的命令行一個新的MP4文件,將其添加:

ffmpeg.exe -i your_file.mp4 -c:v libx264 -profile:v baseline -level 1 new_file_name.mp4