|
楼主 |
发表于 2009-11-24 11:55:21
|
显示全部楼层
Post by Havanna;2049367
请问,输出到图片gif为何不行呢?
需要libgif?
我在#ffmpeg问了这个问题:11:36 < canti> hi there. why this fails? http://dpaste.com/124352/
11:41 < theholydu> canti, i think it sorta
11:41 < theholyduck> prints out why it fails
11:41 < theholyduck> and what to do about it
11:41 < theholyduck> oh wait, you tried that
11:41 < canti> yah..
11:42 < theholyduck> gif output sucks though
11:42 < canti> i also tried putting elsewhere in the commandline -pix_fmt rgb24 ...
11:43 < canti> i agree gif sucks, but somebody wants it xD
11:43 <@Dark_Shikari> ffmpeg's gif output sucks more
11:43 <@Dark_Shikari> try imagemagick maybe
11:44 <@bcoudurier> what's wrong with it ?
11:44 <@Dark_Shikari> I recall that it isn't very optimized iirc...
11:44 <@Dark_Shikari> I don't think it does global palettes
11:44 <@Dark_Shikari> optimized global palettes that is
11:44 <@Dark_Shikari> wait, it doesn't even do optimized palettes period
11:44 < canti> Dark_Shikari: possible to fix my command line?
11:44 <@Dark_Shikari> there's even a great comment that says
11:45 <@Dark_Shikari> "better than nothing gif encoder"
11:45 <@bcoudurier> ah
11:46 < canti> Does it do gif from x11grab? the import command? <-- <@Dark_Shikari> try imagemagick
maybe
11:46 <@Dark_Shikari> why not record the video once
11:46 <@Dark_Shikari> and then convert it to gif later?
11:46 <@Dark_Shikari> or use ffmpeg to write a series of, say, pngs
11:47 <@Dark_Shikari> and then convert those to an animated gif with imagemagick later
11:49 < canti> Dark_Shikari: but that will be huge with pngs, and takes one more extra step with
converting later. i'm using this in a screencast script, gif is just an output
option i thought it/ffmpeg should support.
... ...
11:56 <@bcoudurie> canti, -vcodec rawvideo -pix_fmt rgb24
11:56 < canti> bcoudurier: let me try
11:58 < canti> bcoudurier: it works. but it's HUGE!!! 26M for 5 sec
11:59 <@bcoudurier> yes, lzw compression is missing
11:59 <@bcoudurier> it's "better than nothing"
11:59 < Haxar> or you could just pipe it :p
11:59 <@bcoudurier> anyway I'm off
12:00 < canti> Haxar: i was thinking about this, but well... 看来目前找不到比较好的解决办法 ..
下面的命令使用ImageMagick的convert把ffmpeg编码的raw格式转成压缩格式的gif- $ ffmpeg -r 15 -s 640x480 -an -f x11grab -i ${DISPLAY}+0+0 -vcodec rawvideo -pix_fmt rgb24 -f gif -t 5 - | convert gif:- cast.gif
复制代码 不过rbg24格式录制出来的效果颜色失真是很严重的... 即使上面的办法可行, 我个人也不会采用gif输出...
编辑:
最新的脚本支持使用-c gif或-f gif输出gif文件, 但由于ffmpeg貌似只支持未压缩的gif输出, 文件会很大. 参看git log: fixed :: gif output now is supported, but is uncompressed, which \
means it will be HUGE, possible solutions:
* pipe it to convert gif:- output.gif; this requires ImageMagick;
* find a way to tell ffmpeg how to do compressed gif;
* do not use gif format;
formatting :: rearranged, overall formatting looks clearer. :: 如果必须用gif输出, 目前比较令人满意的解决方法是使用 -o - 管道传送给convert进行gif压缩ffcast -s -t 5 -c gif -f gif -o - --debug | convert gif:- cast.gif |
|