无尽的视频录制 [英] Endless Video Recording
问题描述
我建立一个应用程序,将持有录制视频的60秒缓冲。视频记录需要为在延长的时间周期(24-48小时)运行。我似乎没有有记录的任何问题,但现在看来,我失去了我的相机连接
或表面
后的几个小时的时间。
I am building an app that will hold a 60 second buffer of recorded video. The video recording needs to run for an extended period of time (24-48 hours). I do not seem to have any issues with recording, but it appears that I lose the connection with my Camera
or Surface
after a few hours of time.
我设置最大持续时间: MediaRecorder.setMaxDuration(10 * 1000)
,以便记录被分解成10个第二段
I am setting the max duration: MediaRecorder.setMaxDuration(10 * 1000)
so that recording is broken up into 10 second segments.
每个时间我重新启动记录我递增输出文件以这样一种方式,6个文件被重复使用。其目的是保持60秒的历史时刻。
Each time I restart my recording I am incrementing the output file in such a way that 6 files are reused. The purpose is to keep a 60 second history at all times.
如果我1-2小时后停止录音录像回放罚款。但是,如果我让它运行3-4个小时以上,并停止录制,视频显示只有黑色输出的与音频。换句话说,这是因为如果它失去了用相机或表面的的连接,但继续录制音频
If I stop the recording after 1-2 hours the videos play back fine. However, if I let it run for 3-4+ hours and stop the recording, the videos shows only black output with audio. In other words, it is as if it lost a connection with the camera or surface but continued recording audio.
任何人都可以解释这种现象?
Can anyone explain this behavior?
如果不出意外,有没有更好的方式来记录的 X 视频第二段?
If nothing else, is there a better way to record X second segments of video?
FYI:我使用的是唤醒锁使画面/ CPU留在
FYI: I am using a wake lock so that the screen/CPU stay on.
推荐答案
我已经有点在这里回答了我自己的问题。我没有很多的信息,但希望这将提供足够的信息,以帮助他人在类似predicament。
I have sort of answered my own question here. I don't have a lot of information, but hopefully this will provide enough information to help others in a similar predicament.
首先,我从来没有张贴了我的code,因为它的办法的过于冗长。我没有张贴我的code的片段,因为我不知道问题出在哪里了始发。尽管我有现在这样的工作,我仍然不知道什么是错的我的老code。
First, I never posted my code because it's way too lengthy. I didn't post snippets of my code because I did not know where the problem was originating. Despite the fact that I have this working now, I still do not know what was wrong with my old code.
我的建议是:
我结束了我再杀code和开始的发展API演示发现,code记忆犹新:<一href=\"http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/Camera$p$pview.html\"相对=nofollow> 相机preVIEW
- 我发现在这个网站中至少有一个线程此引用
I ended up scrapping my code and starting fresh with the code found in the Development API Demos: CameraPreview
-- I found this references in at least one thread on this site.
在那之后我能够不断小时就结束拍摄没有问题。所以,如果你是在一个类似的情况,我建议使用相机preVIEW
code作为一个起点。
After that I was able to continually record for hours on end without problem. So if you are in a similar situation, I would suggest using the CameraPreview
code as a starting point.
这篇关于无尽的视频录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!