video encoding - FFmpeg not converting first image
2013-08
Possible Duplicate:
Ffmpeg sync error, first image showing really fast
I'm using Windows and FFmpeg for Windows.
My material are 8 images, with names like:
product0001img01.png
product0001img02.png
product0001img03.png
- and so on
When I use KMPplayer or GOM, it's showing only product0001img02.png
until product0001img08.png
. I tried to upload it to YouTube, which gave me the same result.
But when playing it with KliteMegaCodec, all the images are loaded fine.
I use the following command:
ffmpeg -r 1/7 -i "C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\WBAY\WBAY\bin\Debug\data\tempimages/product0001img%02d.png" -vcodec libx264 -y "C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\WBAY\WBAY\bin\Debug\data\temp/product0001.mp4"
Here's the log:
ffmpeg version N-48228-gceee440 Copyright (c) 2000-2012 the FFmpeg developers
built on Dec 27 2012 01:53:09 with gcc 4.7.2 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 12.100 / 52. 12.100
libavcodec 54. 81.100 / 54. 81.100
libavformat 54. 50.102 / 54. 50.102
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 30.101 / 3. 30.101
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
Input #0, image2, from 'C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\WBAYdevWITHSHORTENER\WBAY\bin\Debug\data\tempimages/product0001img%02d.png':
Duration: 00:00:00.32, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba, 640x360, 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 02625020] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 02625020] profile High, level 2.2
[libx264 @ 02625020] 264 - core 129 r2230 1cffe9f - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - 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=6 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=1 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 'C:\Documents and Settings\admin\My Documents\Visual Studio 2008\Projects\WBAYdevWITHSHORTENER\WBAY\bin\Debug\data\temp/product0001.mp4':
Metadata:
encoder : Lavf54.50.102
Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360, q=-1--1, 16384 tbn, 0.14 tbc
Stream mapping:
Stream #0:0 -> #0:0 (png -> libx264)
Press [q] to stop, [?] for help
frame= 8 fps=0.0 q=2292935.0 Lsize= 165kB time=00:00:42.00 bitrate= 32.1kbits/s
video:164kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.501697%
[libx264 @ 02625020] frame I:2 Avg QP:15.47 size: 34494
[libx264 @ 02625020] frame P:6 Avg QP:15.49 size: 16319
[libx264 @ 02625020] mb I I16..4: 39.6% 18.0% 42.3%
[libx264 @ 02625020] mb P I16..4: 20.0% 10.7% 21.8% P16..4: 5.3% 3.5% 2.9% 0.0% 0.0% skip:35.7%
[libx264 @ 02625020] 8x8 transform intra:19.4% inter:28.2%
[libx264 @ 02625020] coded y,uvDC,uvAC intra: 54.8% 46.1% 38.8% inter: 13.4% 13.6% 10.4%
[libx264 @ 02625020] i16 v,h,dc,p: 82% 9% 5% 4%
[libx264 @ 02625020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 30% 20% 5% 4% 3% 6% 5% 10%
[libx264 @ 02625020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 33% 28% 10% 4% 5% 5% 5% 4% 5%
[libx264 @ 02625020] i8c dc,h,v,p: 64% 20% 12% 4%
[libx264 @ 02625020] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 02625020] ref P L0: 32.5% 5.5% 51.9% 10.1%
[libx264 @ 02625020] kb/s:23.84
Here youtube links YoutubeLinks
If the end goal is to obtain a working mp4 from a series of images, an alternative to programming your own solution and using FFmpeg, you can use the free Windows Movie Maker (for Win7 and 8). The 2012 version (without the 'live" of the former version) outputs MP4 (for web and youtube) or AVI. It can convert a series of stills into a mp4. Once Movie Maker is installed, start a new project and add your PNG's. The default frame rate is 7 seconds per still image, but you can manually type in any value (.01 or greater). I was pleased to find this much easier and better quality than some of the other "images to video" conversion tools. (ImageMagick is another, similiar to FFmpeg).
As mentioned by Karan, Its FFMPEG issue ( CMIW) FFmpeg is adding the first image to the video, just that the delay is so short it's not visible.
So I marking this as answers for my questions :)
Im using the following command, which works for most files, except what seems to be xvid encoded ones
/usr/bin/ffmpeg -sameq -i file.avi -ss 00:01:00 -t 00:00:30 -ac 2 -r 25 -copyts output.avi
So this should basically splice out 30 seconds of video + audio, starting from 1 minute mark.
It does START encoding at the 00:01:00 mark but it goes all the way to the end of the file for some reason, ignoring that I want just 30 seconds.
The output looks like this.
FFmpeg version git-ecc4bdd, Copyright (c) 2000-2010 the FFmpeg developers
built on May 31 2010 04:52:24 with gcc 4.4.3 20100127 (Red Hat 4.4.3-4)
configuration: --enable-libx264 --enable-libxvid --enable-libmp3lame --enable-libopenjpeg --enable-libfaac --enable-libvorbis --enable-gpl --enable-nonfree --enable-libxvid --enable-pthreads --enable-libfaad --extra-cflags=-fPIC --enable-postproc --enable-libtheora --enable-libvorbis --enable-shared
libavutil 50.15. 2 / 50.15. 2
libavcodec 52.67. 0 / 52.67. 0
libavformat 52.62. 0 / 52.62. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.20. 0 / 1.20. 0
libswscale 0.10. 0 / 0.10. 0
libpostproc 51. 2. 0 / 51. 2. 0
[mpeg4 @ 0x17cf770]Invalid and inefficient vfw-avi packed B frames detected
Input #0, avi, from 'file.avi':
Metadata:
ISFT : VirtualDubMod 1.5.10.2 (build 2540/release)
Duration: 00:02:00.00, start: 0.000000, bitrate: 1587 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 672x368 [PAR 1:1 DAR 42:23], 25 tbr, 25 tbn, 25 tbc
Stream #0.1: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
File 'lol6.avi' already exists. Overwrite ? [y/N] y
Output #0, avi, to 'lol6.avi':
Metadata:
ISFT : Lavf52.62.0
Stream #0.0: Video: mpeg4, yuv420p, 672x368 [PAR 1:1 DAR 42:23], q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream #0.1: Audio: mp2, 48000 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Press [q] to stop encoding
[mpeg4 @ 0x17cf770]Invalid and inefficient vfw-avi packed B frames detected
[buffer @ 0x184b610]Buffering several frames is not supported. Please consume all available frames before adding a new one.
frame= 1501 fps=104 q=0.0 Lsize= 15612kB time=30.02 bitrate=4259.7kbits/s ts/s
video:15303kB audio:235kB global headers:0kB muxing overhead 0.482620%
if I convert this file to mp4 for example, and then perform the same action, it works perfectly.
I presume your "convert to MP4" operation is just a container change, not a full re-encode of the A/V data streams. So perhaps FFmpeg is getting hung up on something broken in those AVI containers. This line in your output might support this:
[mpeg4 @ 0x17cf770]Invalid and inefficient vfw-avi packed B frames detected
You could try creating a new AVI container -- let FFmpeg copy the entire file, eg with:
ffmpeg -i input.avi -vcodec copy -acodec copy output.avi
This should create a new AVI container and copy the data streams. Then try your command again. If it works, you've got broken AVIs (or possibly an FFmpeg bug) -- either way, you can put all your videos into new AVI containers and get it done that way.
If that doesn't work, you might look further into the broken XviDs and see what they have in common.
I wonder if your problem is the same as in this article:
Convert any video file for an iPod or iPhone
You want to use your fancy new Apple iPod Video or Apple iPhone, but you don't know how to convert video so it will play.
Ubuntu 9.10 (Karmic Koala) ships with a version of ffmpeg without libfaac support because of licensing issues. This means you will need to compile ffmpeg yourself. This guide explains how.
The article explains, step-by-step, how to compile ffmpeg by hand or create a modified ffmpeg package, that includes libfaac to support Advanced Audio Coding (AAC).