2013-05-30 285 views
0

因此,我有一個腳本從Web抓取一堆圖像,然後將它們轉換爲電影。然而,當我運行它時,我會遇到大量的錯誤。ffmpeg將圖像轉換爲mp4錯誤

首先讓我展示一下我運行,然後我會後的錯誤,因爲它是巨大的:

#for gif 
#call('convert -set delay 5 -loop 0 ' + folder + '*.jpg ' + name + '.gif', shell=True) 
#for mov 
#call('convert -quality 100 ' + folder + '*.jpg ' + name + '.mov', shell=True) 
#for organized movie 
call('ffmpeg -r 10 -b 1800 -i ' + folder + '%0' + str(size) + 'd.jpg ' + name + '.mp4', shell=True) 

所以註釋掉版本的做工精細,但我需要使用第三版本!下面是我從ffmpeg的得到響應:

ffmpeg version 1.2 Copyright (c) 2000-2013 the FFmpeg developers 
    built on Mar 31 2013 21:55:33 with Apple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn) 
    configuration: --prefix=/opt/local --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libopus --enable-libtheora --enable-libschroedinger --enable-libopenjpeg --enable-libmodplug --enable-libvpx --enable-libspeex --enable-libfreetype --mandir=/opt/local/share/man --enable-shared --enable-pthreads --cc=/usr/bin/clang --arch=x86_64 --enable-yasm --enable-gpl --enable-postproc --enable-libx264 --enable-libxvid 
    libavutil  52. 18.100/52. 18.100 
    libavcodec  54. 92.100/54. 92.100 
    libavformat 54. 63.104/54. 63.104 
    libavdevice 54. 3.103/54. 3.103 
    libavfilter  3. 42.103/3. 42.103 
    libswscale  2. 2.100/2. 2.100 
    libswresample 0. 17.102/0. 17.102 
    libpostproc 52. 2.100/52. 2.100 
Please use -b:a or -b:v, -b is ambiguous 
[mjpeg @ 0x7f8cc402a800] [IMGUTILS @ 0x7fff5a680ae0] Picture size 10835x53928 is invalid 
    Last message repeated 26 times 
[mjpeg @ 0x7f8cc402a800] Found EOI before any SOF, ignoring 
[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (cf) 
[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (c8) 
[mjpeg @ 0x7f8cc402a800] [IMGUTILS @ 0x7fff5a680ae0] Picture size 54310x53928 is invalid 
[mjpeg @ 0x7f8cc402a800] only 8 bits/component accepted 
    Last message repeated 8 times 
[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (c5) 
[mjpeg @ 0x7f8cc402a800] [IMGUTILS @ 0x7fff5a680ae0] Picture size 10835x53928 is invalid 
    Last message repeated 12 times 
[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (cf) 
[mjpeg @ 0x7f8cc402a800] only 8 bits/component accepted 
[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (cf) 
[mjpeg @ 0x7f8cc402a800] only 8 bits/component accepted 
[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (cf) 
[mjpeg @ 0x7f8cc402a800] only 8 bits/component accepted 
[image2 @ 0x7f8cc4029c00] decoding for stream 0 failed 
[image2 @ 0x7f8cc4029c00] Could not find codec parameters for stream 0 (Video: mjpeg): unspecified size 
Consider increasing the value for the 'analyzeduration' and 'probesize' options 
/Users/ryansaxe/Desktop/kaggle_parkinsons/MOVIES/%03d.jpg: could not find codec parameters 

注:[mjpeg @ 0x7f8cc402a800] mjpeg: unsupported coding type (cf) [mjpeg @ 0x7f8cc402a800] only 8 bits/component accepted重複約30次,但我把它剪出來的回溯,因爲它是壓倒性的。

問題:我做錯了什麼,如何解決?

編輯:

我下載使用JPEG文件的urllib Python庫的urlretrieve。這是我如何保存它們:

for src,name in zip(urls,range(len(urls))): 
    file_name = folder + str(name) + '.jpg' 
    urlretrieve(src, file_name) 
+0

在使用'call'之前打印行。你可能會把錯誤傳遞給ffmpeg。順便說一句,將'-b 1800'改爲'-b:v 1800K'或將其刪除 – JBernardo

+0

哪一行?那個電話正在使用? –

+0

FFmpeg似乎對JPEG文件不滿意。你確定他們有效嗎?他們都是連續的嗎?你能用其他軟件解碼嗎? –

回答

0

首先,添加一行:

print('ffmpeg -r 10 -b 1800 -i ' + folder + '%0' + str(size) + 'd.jpg ' + name + '.mp4') 

call之前。

其次,從shell運行此行。從那裏調試。

細分問題有幫助。