2011-12-08 65 views
1

我想從不同的png圖像創建視頻。我的代碼是:如何使用ffmpeg從png圖像創建視頻

ffmpeg -r 20 -f image2 -i slideshow/%d.png -y -s 320x240 -aspect 4:3 out.mp4 

和我收到的輸出:

FFmpeg version SVN-r26400, Copyright (c) 2000-2011 the FFmpeg developers 
    built on Sep 27 2011 00:47:07 with gcc 4.1.2 20080704 (Red Hat 4.1.2-50) 
    configuration: --enable-avfilter --enable-filter=fade 
    libavutil  50.36. 0/50.36. 0 
    libavcore  0.16. 1/0.16. 1 
    libavcodec 52.108. 0/52.108. 0 
    libavformat 52.93. 0/52.93. 0 
    libavdevice 52. 2. 3/52. 2. 3 
    libavfilter 1.74. 0/1.74. 0 
    libswscale  0.12. 0/0.12. 0 
Input #0, image2, from 'slideshow/%d.png': 
    Duration: 00:00:00.25, start: 0.000000, bitrate: N/A 
    Stream #0.0: Video: png, rgb24, 720x471, 20 fps, 20 tbr, 20 tbn, 20 tbc 
[buffer @ 0x9687230] w:720 h:471 pixfmt:rgb24 
[scale @ 0x9687600] w:720 h:471 fmt:rgb24 -> w:320 h:240 fmt:yuv420p flags:0xa0000004 
Output #0, mp4, to 'out.mp4': 
    Metadata: 
    encoder   : Lavf52.93.0 
    Stream #0.0: Video: mpeg4, yuv420p, 320x240 [PAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 20 tbn, 20 tbc 
Stream mapping: 
    Stream #0.0 -> #0.0 
Press [q] to stop encoding 
Segmentation fault 

可能是什麼問題?請幫助... 目前我使用的是centos 5服務器。

回答

2

最後我找到了解決問題的方法。我不知道爲什麼,但在多個尺寸的PNG圖像的情況下,ffmpeg沒有創建視頻,但是當我使用相同大小的png圖像創建時沒有錯誤。所以,我從圖像剪裁類似大小的thumnails和使用這些縮略圖創建視頻,我能夠生成幻燈片...