可能是一个快速的anwser,但我第一次尝试这样做。我有77张jpeg图片,我将它们重命名为000.jpg - 076.jpg。下一步是使用ffmpeg,这是我的命令语句:
ffmpeg -f image2 -r .1 -i %d.jpg -r 25 test.avi
它创建一个带有10个图像的avi,每个10秒,为什么只有10个?我在ffmpeg命令中尝试了%d.jpg的其他迭代但没有成功。
感谢所有的帮助!
-Jim
以下是包含图片的目录列表:
ls -l
total 77472
-rwxr-xr-x 1 jim jim 2329065 May 17 16:31 000.jpg
-rwxr-xr-x 1 jim jim 716563 May 17 16:31 001.jpg
-rwxr-xr-x 1 jim jim 716626 May 17 16:31 002.jpg
-rwxr-xr-x 1 jim jim 726686 May 17 16:31 003.jpg
-rwxr-xr-x 1 jim jim 739312 May 17 16:31 004.jpg
-rwxr-xr-x 1 jim jim 720249 May 17 16:31 005.jpg
-rwxr-xr-x 1 jim jim 666757 May 17 16:31 006.jpg
-rwxr-xr-x 1 jim jim 656259 May 17 16:31 007.jpg
-rwxr-xr-x 1 jim jim 664960 May 17 16:31 008.jpg
-rwxr-xr-x 1 jim jim 740801 May 17 16:31 009.jpg
-rwxr-xr-x 1 jim jim 882502 May 17 16:31 010.jpg
-rwxr-xr-x 1 jim jim 631117 May 17 16:31 011.jpg
-rwxr-xr-x 1 jim jim 730331 May 17 16:31 018.jpg
-rwxr-xr-x 1 jim jim 725132 May 17 16:31 019.jpg
-rwxr-xr-x 1 jim jim 729626 May 17 16:31 020.jpg
-rwxr-xr-x 1 jim jim 731980 May 17 16:31 021.jpg
-rwxr-xr-x 1 jim jim 671597 May 17 16:31 022.jpg
-rwxr-xr-x 1 jim jim 681978 May 17 16:31 023.jpg
-rwxr-xr-x 1 jim jim 686600 May 17 16:31 024.jpg
-rwxr-xr-x 1 jim jim 675316 May 17 16:31 025.jpg
-rwxr-xr-x 1 jim jim 681826 May 17 16:31 026.jpg
-rwxr-xr-x 1 jim jim 740998 May 17 16:31 027.jpg
-rwxr-xr-x 1 jim jim 568480 May 17 16:31 028.jpg
-rwxr-xr-x 1 jim jim 747400 May 17 16:31 029.jpg
-rwxr-xr-x 1 jim jim 630995 May 17 16:31 030.jpg
-rwxr-xr-x 1 jim jim 689926 May 17 16:31 031.jpg
-rwxr-xr-x 1 jim jim 685054 May 17 16:31 032.jpg
-rwxr-xr-x 1 jim jim 710620 May 17 16:31 033.jpg
-rwxr-xr-x 1 jim jim 658365 May 17 16:31 034.jpg
-rwxr-xr-x 1 jim jim 657037 May 17 16:31 035.jpg
-rwxr-xr-x 1 jim jim 772135 May 17 16:31 036.jpg
-rwxr-xr-x 1 jim jim 741759 May 17 16:31 037.jpg
-rwxr-xr-x 1 jim jim 807470 May 17 16:31 038.jpg
-rwxr-xr-x 1 jim jim 748423 May 17 16:31 039.jpg
-rwxr-xr-x 1 jim jim 712377 May 17 16:31 040.jpg
-rwxr-xr-x 1 jim jim 715804 May 17 16:31 041.jpg
-rwxr-xr-x 1 jim jim 701025 May 17 16:31 042.jpg
-rwxr-xr-x 1 jim jim 759446 May 17 16:31 043.jpg
-rwxr-xr-x 1 jim jim 621801 May 17 16:31 044.jpg
-rwxr-xr-x 1 jim jim 720843 May 17 16:31 045.jpg
-rwxr-xr-x 1 jim jim 704002 May 17 16:31 046.jpg
-rwxr-xr-x 1 jim jim 696075 May 17 16:31 047.jpg
-rwxr-xr-x 1 jim jim 723685 May 17 16:31 048.jpg
-rwxr-xr-x 1 jim jim 732332 May 17 16:31 049.jpg
-rwxr-xr-x 1 jim jim 747235 May 17 16:31 050.jpg
-rwxr-xr-x 1 jim jim 883655 May 17 16:31 051.jpg
-rwxr-xr-x 1 jim jim 1750723 May 17 16:31 052.jpg
-rwxr-xr-x 1 jim jim 1002588 May 17 16:31 053.jpg
-rwxr-xr-x 1 jim jim 540666 May 17 16:31 054.jpg
-rwxr-xr-x 1 jim jim 1876002 May 17 16:31 055.jpg
-rwxr-xr-x 1 jim jim 1893761 May 17 16:31 056.jpg
-rwxr-xr-x 1 jim jim 1979442 May 17 16:31 057.jpg
-rwxr-xr-x 1 jim jim 1766249 May 17 16:31 058.jpg
-rwxr-xr-x 1 jim jim 2085989 May 17 16:31 059.jpg
-rwxr-xr-x 1 jim jim 883871 May 17 16:31 060.jpg
-rwxr-xr-x 1 jim jim 755714 May 17 16:31 061.jpg
-rwxr-xr-x 1 jim jim 797146 May 17 16:31 062.jpg
-rwxr-xr-x 1 jim jim 2431531 May 17 16:31 065.jpg
-rwxr-xr-x 1 jim jim 2413333 May 17 16:31 066.jpg
-rwxr-xr-x 1 jim jim 2449278 May 17 16:31 067.jpg
-rwxr-xr-x 1 jim jim 2458183 May 17 16:31 068.jpg
-rwxr-xr-x 1 jim jim 2514419 May 17 16:31 069.jpg
-rwxr-xr-x 1 jim jim 2477737 May 17 16:31 070.jpg
-rwxr-xr-x 1 jim jim 2471347 May 17 16:31 071.jpg
-rwxr-xr-x 1 jim jim 2384936 May 17 16:31 072.jpg
-rwxr-xr-x 1 jim jim 2459983 May 17 16:31 073.jpg
-rwxr-xr-x 1 jim jim 2501286 May 17 16:31 074.jpg
-rwxr-xr-x 1 jim jim 2367710 May 17 16:31 075.jpg
-rwxr-xr-x 1 jim jim 2455564 May 17 16:31 076.jpg
FFMPEG命令和OUTPUT:
ffmpeg -v verbose -f image2 -r .1 -i %03d.jpg -r 25 test.avi
ffmpeg version 0.8.1-4:0.8.1-0ubuntu1, Copyright (c) 2000-2011 the Libav developers
built on Mar 22 2012 05:09:06 with gcc 4.6.3
configuration: --extra-version='4:0.8.1-0ubuntu1' --arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
avutil configuration: --extra-version='4:0.8.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libfreetype --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
avcodec configuration: --extra-version='4:0.8.1ubuntu1+medibuntu1' --arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-libfreetype --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-version3 --enable-libopencore-amrwb --enable-version3 --enable-libvo-aacenc --enable-version3 --enable-libvo-amrwbenc --enable-version3 --enable-libdc1394 --shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
libavutil 51. 22. 1 / 51. 22. 1
libavcodec 53. 35. 0 / 53. 35. 0
libavformat 53. 21. 0 / 53. 21. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 15. 0 / 2. 15. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 52. 0. 0 / 52. 0. 0
This program is not developed anymore and is only provided for compatibility. Use avconv instead (see Changelog for the list of incompatible changes).
[image2 @ 0x1bef9c0] max_analyze_duration reached
Seems stream 0 codec frame rate differs from container frame rate: 0.10 (1/10) -> 0.50 (1/2)
Input #0, image2, from '%03d.jpg':
Duration: 00:02:00.00, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj440p, 1920x2560, 0.10 fps, 0.50 tbr, 0.10 tbn, 0.10 tbc
File 'test.avi' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'yuvj440p' for codec 'mpeg4', auto-selecting format 'yuv420p'
[buffer @ 0x1bf0100] w:1920 h:2560 pixfmt:yuvj440p
[avsink @ 0x1bf13c0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1bf1ae0] w:1920 h:2560 fmt:yuvj440p -> w:1920 h:2560 fmt:yuv420p flags:0x4
Output #0, avi, to 'test.avi':
Metadata:
ISFT : Lavf53.21.0
Stream #0.0: Video: mpeg4, yuv420p, 1920x2560, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
[buffer @ 0x1bf0100] Changing frame properties on the fly is not supported.
Last message repeated 10 times
frame= 1 fps= 0 q=5.7 Lsize= 97kB time=0.04 bitrate=19823.2kbits/s
video:91kB audio:0kB global headers:0kB muxing overhead 6.106282%
现在test.avi只有99Kbs而且没有播放任何东西。
答案 0 :(得分:3)
在这种情况下,它应该是%03d,因为你有三位数。我不确定它是如何运行的,但我不认为这会导致问题。我唯一能想到的是,在你的图像序列中,图像#11出现故障(命名不正确)。如果图像不是全部按顺序排列,则ffmpeg假定序列在找不到下一个数字时完成。要么通过并检查,要么在控制台的ffmpeg文档中运行脚本的变体(如果你在Windows上,则为MinGW)以自动重命名它们。
如果仍然无法解决问题,请发布整个ffmpeg控制台输出(在ffmpeg命令中传递“-report”,它会保存带有日志的文本文件)。