gpt4 book ai didi

Android mp4 媒体文件无法播放

转载 作者:行者123 更新时间:2023-12-04 22:50:57 25 4
gpt4 key购买 nike

我遇到了与 here 相同的问题我认为这是因为文件(记录在 iOS 上)被编码为 .mov 而不是 .mp4。

然后我更改了我的 iOS 应用程序上的编码机制,将它们编码为 mp4,但我仍然看到同样的问题。

当我加载文件时

File videoFile = ...;
videoView.setVideoPath(videoFile.getAbsolutePath());
videoView.start();

我得到 E/MediaPlayer(2069): error (1, -2147483648) .

当我使用以下内容加载文件时(来自上面的链接)。
Uri uri = Uri.parse(VideoProvider.CONTENT_URI_BASE + Uri.encode(videoFile.getAbsolutePath()));
videoView.setVideoURL(url);
videoView.start();

我在 logcat 中得到了这个
07-17 08:05:58.283: W/VideoView(2276): Unable to open content: content://com.companyname.VideoProvider.files.files/%2Fdata%2Fdata%2Fcom.companyname.myappname%2Fcache%2FiX0mXVPxih.mp4
07-17 08:05:58.283: W/VideoView(2276): java.io.IOException: setDataSource failed.: status=0x80000000

ffmpeg 告诉我有关媒体文件的以下信息:
ffmpeg -i media.mp4
ffmpeg version 2.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 26 2014 15:29:01 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libavresample 1. 2. 0 / 1. 2. 0
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'media.mp4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp41mp42isom
creation_time : 2014-07-17 08:59:24
Duration: 00:00:08.14, start: 0.000000, bitrate: 1084 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 360x480, 1027 kb/s, 24.46 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2014-07-17 08:59:24
handler_name : Core Media Video
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 62 kb/s (default)
Metadata:
creation_time : 2014-07-17 08:59:24
handler_name : Core Media Audio

知道为什么这个文件可能无法加载吗?

编辑:在模拟器中运行时,这似乎主要是一个问题,但在设备上,如果我使用 SurfaceView,我似乎已经成功让它工作。和 MediaPlayer而不是 VideoView .

最佳答案

您确定该文件实际上是在设备上找到的吗?如果您还没有,您可以尝试以下方法:

File videoFile = ...;
if(videoFile.exists){
videoView.setVideoPath(videoFile.getAbsolutePath());
videoView.start();
}else{
Log.e("Video file not found :(!");
}

关于Android mp4 媒体文件无法播放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24803125/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com