ffmpeg的 - 不允许操作错误而转换 [英] ffmpeg - operation not permitted error while conversion
问题描述
我正在开发Android应用程序。我的要求是,要实现一个RTSP Android上的流媒体服务器。它住用 MediaRecorder
流视频和音频捕获。另一个要求是,我必须使用LIVE555作为流媒体服务器。我从 MediaRecorder
得到的是在MP4或3GP格式。 LIVE555能不能既流。但是,如果我只是在'RAW_AMR'格式记录它,它可以流音频。由于流媒体支持LIVE555英里的格式,我决定把某人中间谁可以转换MP4或3GP'到'省油',而我选择的ffmpeg。
I am developing an android app. My requirement is that to implement an rtsp streaming server on android. It has to live stream video and audio captured using MediaRecorder
. Another requirement is that I have to use live555 as the streaming server. What I get from MediaRecorder
is in MP4 or 3GP format. live555 cannot able to stream both. But it can stream audio if I recorded it only in 'RAW_AMR' format. Since live555 support 'mpg' format for streaming, I decided to put someone in middle who can convert 'mp4' or '3gp' to 'mpg', and I chose ffmpeg.
我已经移植LIVE555和FFMPEG到Android。 ffmpeg的是能一旦完成由记录文件MediaRecorder
转换。但问题是,ffmpeg的不能能够同时做到这一点。也就是说,ffmpeg的不能够转换文件的同时录制。它显示了一个不允许操作
错误。我想我的Linux机器上一样,使用VLC,而不是 MediaRecorder
的记录在Android上。其结果是一样的。 ffmpeg的是能够转换一旦录制完成,并没有能够做到同样的录音时。
I have ported live555 and ffmpeg to android. ffmpeg is able to convert the file recorded by MediaRecorder
once it is finished. But the problem is that ffmpeg cannot be able to do it concurrently. That is, ffmpeg is not able to convert the file while recording. It shows an Operation not permitted
error. I tried the same on my linux machine, using VLC to record instead of MediaRecorder
on android. The result is same. ffmpeg is able to convert once the recording is finished, and not able to do the same while recording.
下面是我在我的Linux机器发出的ffmpeg的命令:
Here is the ffmpeg command I issued on my linux box:
ffmpeg -v 9 -loglevel 99 -i test.mp4 test.mpg
其中, test.mp4
是文件到VLC在 MP4
格式进行录制。和 test.mpg
是我的目标文件。以下是ffmpeg的端子输出。
Where test.mp4
is the file to which VLC is recording in mp4
format. and test.mpg
is my destination file. The following is the output by ffmpeg on terminal.
ffmpeg version 0.8.9, Copyright (c) 2000-2011 the FFmpeg developers
built on Feb 1 2012 18:29:27 with gcc 4.6.2 20111027 (Red Hat 4.6.2-1)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic' --enable-bzlib --enable-libcelt --enable-libdc1394 --enable-libdirac --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 8. 0 / 53. 8. 0
libavformat 53. 5. 0 / 53. 5. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1672600] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1672600] ISO: File Type Major Brand: isom
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1672600] moov atom not found
test.mp4: Operation not permitted
会有人告诉我是什么原因造成的问题?还是上面的场景是可以通过的ffmpeg。即,ffmpeg的是能够在同一时间作为记录做转换?如果它是不可能通过的ffmpeg,请你提出任何替代性解决方案?
Would anyone please tell me what is causing the problem? Or is the scenario above is possible by ffmpeg. That is, is ffmpeg is able to do the conversion at the same time as that of recording? If it is not possible by ffmpeg, would you please suggest any alternative solutions?
请注意:我把一个 C
标签,因为如果它可以通过在ffmpeg的C语言带来的调整,我愿意这样做(我想要的解决方案,它严重) 。但请提供一些指向正确的方向。
NOTE: I am putting a C
tag because if it possible by some tweaking in C on ffmpeg, I am ready to do that(I want the solution that badly). But please provide some pointers to the right direction.
推荐答案
两个 3GP
和 MP4
格式包括MOOV当该文件被最后确定被写入原子(数据块)。在那之前,文件不完整。
Both 3gp
and mp4
formats include moov atom (chunk of data) that is written when the file is finalized. Until then the file is incomplete.
您可以使用 FLV
作为中间的格式。支持流媒体直播等格式都可以使用得。选项 -re
可能会有所帮助,告诉EN codeR以流的速率运行,如果需要的话。
You can use FLV
as the "middle" format. Other formats that support live streaming can be used too. Option -re
may be helpful to tell encoder to run at the stream rate, if needed.
又见<一个href=\"http://stackoverflow.com/questions/6353519/is-it-possible-to-play-an-output-video-file-from-an-en$c$cr-as-its-being-en$c$c\">Is它可以从一间codeR因为它是连接codeD播放输出的视频文件?。
这篇关于ffmpeg的 - 不允许操作错误而转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!