抱歉,该视频无法在 Android 中流式传输到此设备

发布于 2024-11-26 11:57:17 字数 1390 浏览 2 评论 0原文

对于尝试播放录制的音频和视频时出现的警告,我们没有得到任何解决方案。警告是

抱歉,该视频无法流式传输到此设备。

我们使用以下代码,该代码在之前的设备(Nexus One)中已经运行良好。

 recorder = new MediaRecorder();
 recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
 recorder.setVideoSize(176, 144);
 recorder.setVideoFrameRate(15);
 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setMaxDuration(30000);
 recorder.setPreviewDisplay(holder.getSurface());
 recorder.setOutputFile(OUTPUT_FILE);
 recorder.prepare();
 recorder.start();

我们的设备 Samsung Galaxy Pop S5570 仅支持 mp3 和 mp4,因此我们也尝试使用以下代码。请建议我以下代码是否正确,用于录制 mp4 视频格式

 recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
 recorder.setVideoSize(176, 144);
 recorder.setVideoFrameRate(15);
 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setMaxDuration(30000);
 recorder.setPreviewDisplay(holder.getSurface());
 recorder.setOutputFile(OUTPUT_FILE);

请提供任何可用于录制 mp4 视频和 mp3 音频格式的代码。

We are not getting any solution for the warning which is occurring when we are trying to play the recorded audio and video. The warning is

sorry this video is not valid for streaming to this device'.

We are using the following code which was already worked well in previous device(Nexus One).

 recorder = new MediaRecorder();
 recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
 recorder.setVideoSize(176, 144);
 recorder.setVideoFrameRate(15);
 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setMaxDuration(30000);
 recorder.setPreviewDisplay(holder.getSurface());
 recorder.setOutputFile(OUTPUT_FILE);
 recorder.prepare();
 recorder.start();

And our device Samsung Galaxy Pop S5570 will support only mp3 and mp4 so we tried by using the following code also. Please suggest me the below code is correct, for recording mp4 video format

 recorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
 recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
 recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
 recorder.setVideoSize(176, 144);
 recorder.setVideoFrameRate(15);
 recorder.setVideoEncoder(MediaRecorder.VideoEncoder.H263);
 recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setMaxDuration(30000);
 recorder.setPreviewDisplay(holder.getSurface());
 recorder.setOutputFile(OUTPUT_FILE);

Pleas provide any code available for recording the mp4 video and mp3 audio format.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七堇年 2024-12-03 11:57:17

请尝试使用以下设置

            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
            mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
            mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
            mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
            mediaRecorder.setVideoSize(width, height);
            mediaRecorder.setVideoFrameRate(videoFramePerSecond);

private final int width = 1280;
    private final int height = 720;
    private final int videoFramePerSecond = 30;

这对我有用

please try to use following Settings

            mediaRecorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
            mediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);
            mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
            mediaRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
            mediaRecorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
            mediaRecorder.setVideoSize(width, height);
            mediaRecorder.setVideoFrameRate(videoFramePerSecond);

where

private final int width = 1280;
    private final int height = 720;
    private final int videoFramePerSecond = 30;

This has worked for me

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文