gpt4 book ai didi

Android 视频不适用于流式传输

转载 作者:行者123 更新时间:2023-11-30 04:32:22 26 4
gpt4 key购买 nike

我正在尝试按照代码播放视频。

public class VidplayerActivity extends Activity {

private MediaController mc;
String LINK = "http://***/test.3gp"; // 5 mb

@Override
public void onCreate(Bundle savedInstanceState) {
try {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
VideoView vd = (VideoView) findViewById(R.id.delta);

Uri uri = Uri.parse(LINK);

mc = new MediaController(this);
vd.setMediaController(mc);

vd.setVideoURI(uri);
vd.start();
}
catch(Exception e) {
System.out.println(e.getStackTrace());
}
}

}

它在 android 1.5 和 1.6 中显示“抱歉,此视频无法流式传输到此设备”。视频详情如下

编辑:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/cvbcvb/Desktop/test.3gp':

Metadata:

major_brand     : 3gp4

minor_version : 512

compatible_brands: isomiso23gp4

Duration: 00:03:00.04, start: 0.000000, bitrate: 150 kb/s

Stream #0.0(und): Video: h263, yuv420p, 176x144 [PAR 12:11 DAR

4:3], 138 kb/s, 25 fps, 25 tbr, 25 tbn, 29.97 tbc

Stream #0.1(und): Audio: amrnb, 8000 Hz, 1 channels, flt, 8 kb/s

[STREAM]

index=0

codec_name=h263

codec_long_name=H.263 / H.263-1996, H.263+ / H.263-1998 / H.263 version 2

codec_type=video

codec_time_base=1001/30000

codec_tag_string=s263

codec_tag=0x33363273

width=176

height=144

has_b_frames=0

sample_aspect_ratio=12:11

display_aspect_ratio=4:3

pix_fmt=yuv420p

r_frame_rate=25/1

avg_frame_rate=25/1

time_base=1/25

language=und

start_time=0.000000

duration=180.040000

nb_frames=4501

TAG:language=und

[/STREAM]

[STREAM]

index=1

codec_name=amrnb

codec_long_name=Adaptive Multi-Rate NarrowBand

codec_type=audio

codec_time_base=0/1

codec_tag_string=samr

codec_tag=0x726d6173

sample_rate=8000.000000

channels=1

bits_per_sample=0

r_frame_rate=0/0

avg_frame_rate=0/0

time_base=1/8000

language=und

start_time=0.000000

duration=180.000000

nb_frames=9000

TAG:language=und

[/STREAM]

最佳答案

请阅读此文档:Android Supported Media Formats .仅使用 H 263 进行编码不足以成为在 Android 中流式传输的有效格式。

分辨率必须是:176 x 144 px480 x 360 px 并且在文档的底部也有说明:

For video content that is streamed over HTTP or RTSP, there are additional requirements:

For 3GPP and MPEG-4 containers, the moov atom must precede any mdat atoms.

For 3GPP, MPEG-4, and WebM containers, audio and video samples corresponding to the same time offset may be no more than 500 KB apart. To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.

关于Android 视频不适用于流式传输,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7481193/

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