[FFmpeg-user] corrupted mp4 encoded from images sent from a pipe
pablo platt
pablo.platt at gmail.com
Tue Dec 10 15:21:27 CET 2013
Hi,
I'm encoding mp4 from images sent from phantomjs over a pipe.
The mp4 is corrupted and doesn't play in FF and Chrome.
After repairing it, it plays fine.
Is it possible that phantomjs doesn't gracefully ends the stream?
At the end I'm getting an error:
pipe:: Input/output error
This explains how to send images from phantomjs to stdout:
https://groups.google.com/forum/#!topic/phantomjs/wluVGGjhL90
Command used to create the mp4:
./phantomjs test.js | ./ffmpeg -y -c:v png -f image2pipe -r 10 -i - -c:v
libx264 -pix_fmt yuv420p test.mp4
Command used to fix the corrupted mp4:
./ffmpeg -i corrupted.mp4 -c copy repaired.mp4
More info is listed below.
Thanks
phantomjs test.js
--------------------------------------------------
var page = require('webpage').create();
page.clipRect = { top: 0, left: 0, width: 900, height: 800};
page.viewportSize = { width: 900, height: 800};
var url = 'http://dl.dropbox.com/u/621993/voronoi/voronoi.html';
var frames = 100;
page.open(url, function(){
setInterval(function(){
page.render('/dev/stdout');
if( frames == 0 ){
phantom.exit();
}
frames--;
}, 100);
});
ffmpeg console output
----------------------------------------------------------------
./phantomjs test.js | ./ffmpeg -y -c:v png -f image2pipe -r 10 -i - -c:v
libx264 -pix_fmt yuv420p -movflags +faststart test.mp4
ffmpeg version 2.1-static Copyright (c) 2000-2013 the FFmpeg developers
built on Dec 9 2013 23:45:24 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
configuration: --prefix=/home/user/ffmpeg-static/target
--extra-cflags='-I/home/user/ffmpeg-static/target/include -static'
--extra-ldflags='-L/home/user/ffmpeg-static/target/lib -lm -static'
--extra-version=static --disable-debug --disable-shared --enable-static
--extra-cflags=--static --disable-ffplay --disable-ffserver --disable-doc
--enable-gpl --enable-pthreads --enable-postproc --enable-gray
--enable-runtime-cpudetect --enable-libfaac --enable-libmp3lame
--enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid
--enable-bzlib --enable-zlib --enable-nonfree --enable-version3
--enable-libvpx --disable-devices
libavutil 52. 48.100 / 52. 48.100
libavcodec 55. 39.100 / 55. 39.100
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, image2pipe, from 'pipe:':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba, 900x800 [SAR 2835:2835 DAR 9:8], 10 fps,
10 tbr, 10 tbn, 10 tbc
[libx264 @ 0x9bf1320] using SAR=1/1
[libx264 @ 0x9bf1320] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x9bf1320] profile High, level 3.1
[libx264 @ 0x9bf1320] 264 - core 140 - H.264/MPEG-4 AVC codec - Copyleft
2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=1 lookahead_threads=1
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=10 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf55.19.104
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
900x800 [SAR 1:1 DAR 9:8], q=-1--1, 10240 tbn, 10 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> libx264)
pipe:: Input/output error0 size= 1678kB time=00:00:05.70
bitrate=2411.5kbits/s
[mp4 @ 0x9bf0e00] Starting second pass: moving the moov atom to the
beginning of the file
frame= 101 fps=3.2 q=25.0 Lsize= 2562kB time=00:00:09.90
bitrate=2119.6kbits/s
video:2560kB audio:0kB subtitle:0 global headers:0kB muxing overhead
0.074206%
[libx264 @ 0x9bf1320] frame I:1 Avg QP:21.38 size: 5004
[libx264 @ 0x9bf1320] frame P:57 Avg QP:20.14 size: 37283
[libx264 @ 0x9bf1320] frame B:43 Avg QP:26.23 size: 11400
[libx264 @ 0x9bf1320] consecutive B-frames: 14.9% 85.1% 0.0% 0.0%
[libx264 @ 0x9bf1320] mb I I16..4: 18.0% 80.1% 2.0%
[libx264 @ 0x9bf1320] mb P I16..4: 5.6% 4.7% 2.7% P16..4: 16.1% 16.4%
17.0% 0.0% 0.0% skip:37.5%
[libx264 @ 0x9bf1320] mb B I16..4: 0.2% 0.3% 0.4% B16..8: 24.3% 13.8%
6.8% direct: 5.1% skip:49.1% L0:33.0% L1:39.4% BI:27.6%
[libx264 @ 0x9bf1320] 8x8 transform intra:40.8% inter:26.6%
[libx264 @ 0x9bf1320] coded y,uvDC,uvAC intra: 18.8% 31.2% 24.8% inter:
16.3% 26.1% 20.0%
[libx264 @ 0x9bf1320] i16 v,h,dc,p: 71% 22% 7% 0%
[libx264 @ 0x9bf1320] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 23% 62% 1% 1%
1% 1% 1% 1%
[libx264 @ 0x9bf1320] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 17% 27% 5% 7%
7% 6% 5% 4%
[libx264 @ 0x9bf1320] i8c dc,h,v,p: 69% 18% 12% 2%
[libx264 @ 0x9bf1320] Weighted P-Frames: Y:8.8% UV:7.0%
[libx264 @ 0x9bf1320] ref P L0: 62.1% 11.6% 18.2% 7.9% 0.2%
[libx264 @ 0x9bf1320] ref B L0: 83.5% 16.5%
[libx264 @ 0x9bf1320] kb/s:2075.53
More information about the ffmpeg-user
mailing list