python调用ffmpeg运行时闪屏_在后台运行时ffmpeg挂起

当尝试在后台以&符号运行ffmpeg时,进程会挂起且输出文件未创建。该问题出现在CentOS 6.6系统上,使用ffmpeg 0.10.2版本。即使在Python中使用subprocess.Popen调用ffmpeg也会遇到相同情况。正常运行时,ffmpeg能够正确转换H264格式到avi,但后台运行则会停止并显示已挂起。
摘要由CSDN通过智能技术生成

如果我按如下方式运行ffmpeg:ffmpeg -i H264-media-4.264 4.avi

它工作正常(即4.avi created OK)。但是,如果我尝试在后台运行它:ffmpeg -i H264-media-4.264 4.avi &

它挂起来了!(和4.avi从未创建)

知道吗?

注意:这个问题是python中类似问题的一个隔离,当它试图作为子进程运行时,它也在那里被挂起:ff.py includesps = subprocess.Popen(ffmpeg_list, stderr=subprocess.STDOUT,stdout = subprocess.PIPE)

运行./ff.py运行正常,./ff.py &也挂起。系统:CentOS 6.6

ffmpeg:0.10.2

成功运行的结果:ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers

built on Mar 20 2012 04:34:50 with gcc 4.4.6 20110731 (Red Hat 4.4.6-3)

configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libdirac --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping

libavutil 51. 35.100 / 51. 35.100

libavcodec 53. 61.100 / 53. 61.100

libavformat 53. 32.100 / 53. 32.100

libavdevice 53. 4.100 / 53. 4.100

libavfilter 2. 61.100 / 2. 61.100

libswscale 2. 1.100 / 2. 1.100

libswresample 0. 6.100 / 0. 6.100

libpostproc 52. 0.100 / 52. 0.100

[h264 @ 0x24eac00] max_analyze_duration 5000000 reached at 5000000

[h264 @ 0x24eac00] Estimating duration from bitrate, this may be inaccurate

Input #0, h264, from 'H264-media-4.264':

Duration: N/A, bitrate: N/A

Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 25 fps, 25 tbr, 1200k tbn, 50 tbc

[buffer @ 0x24efa60] w:640 h:480 pixfmt:yuv420p tb:1/1000000 sar:1/1 sws_param:

[mpeg4 @ 0x24eb540] removing common factors from framerate

Output #0, avi, to '4.avi':

Metadata:

ISFT : Lavf53.32.100

Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 tbn, 25 tbc

Stream mapping:

Stream #0:0 -> #0:0 (h264 -> mpeg4)

Press [q] to stop, [?] for help

frame= 2324 fps=477 q=31.0 Lsize= 2603kB time=00:01:32.96 bitrate= 229.4kbits/s

video:2542kB audio:0kB global headers:0kB muxing overhead 2.409572%

挂起运行的结果:ffmpeg version 0.10.2 Copyright (c) 2000-2012 the FFmpeg developers

built on Mar 20 2012 04:34:50 with gcc 4.4.6 20110731 (Red Hat 4.4.6-3)

configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libdirac --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping

libavutil 51. 35.100 / 51. 35.100

libavcodec 53. 61.100 / 53. 61.100

libavformat 53. 32.100 / 53. 32.100

libavdevice 53. 4.100 / 53. 4.100

libavfilter 2. 61.100 / 2. 61.100

libswscale 2. 1.100 / 2. 1.100

libswresample 0. 6.100 / 0. 6.100

libpostproc 52. 0.100 / 52. 0.100

[5]+ Stopped ffmpeg -i H264-media-4.264 4.avi

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值