Общая задача - наложить анимационную инфографику на видео.
Что бы я хотел в результате показать в этом видео http://www.youtube.com/watch?v=ZhMF3WD9pr0
Хорошая анимированная полупрозрачная голубая линия на 00:08-00:11
Выяснили, как это сделать, наложив изображения одно за другим с помощью "convert" из ImageMagick. Работает нормально, но медленно.
Пытался создавать и накладывать видео с прозрачностью в соответствии с ответами в этой теме stackoverflow.com/questions/644684/turn-image-sequence-into-video-with-transparency
и некоторые импровизации, такие как:
ffmpeg -loop 1 -i ./frames/0253.png -r 30 -t 3 -pix_fmt rgba -vcodec png frame.mov
затем создать видео с альфа-каналом из анимированных фотографий
ffmpeg -pattern_type glob -i 'angle/*.png' -r 30 -pix_fmt rgba -vcodec png z.mov
И оверлейные видео
ffmpeg -i frame.mov -i z.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -pix_fmt rgba -vcodec png test.mov
Но все это приводит к грубой пиксельной картине
Буду признателен за некоторые подсказки о том, что я здесь скучаю и что еще я мог сделать ...
Полный вывод ffmpeg:
alexandrov@ThinkPad-Edge:~/Documents/training 20150109/edit$ ffmpeg -loop 1 -i ./frames/0253.png -r 30 -t 3 -pix_fmt rgba -vcodec png frame.mov >> log.txt
ffmpeg version 2.5.git Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 11 2015 19:12:34 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/home/alexandrov/ffmpeg_build --extra-cflags=-I/home/alexandrov/ffmpeg_build/include --extra-ldflags=-L/home/alexandrov/ffmpeg_build/lib --bindir=/home/alexandrov/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
libavutil 54. 16.100 / 54. 16.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 18.100 / 56. 18.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 7.100 / 5. 7.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, png_pipe, from './frames/0253.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgb24, 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'frame.mov' already exists. Overwrite ? [y/N] y
Output #0, mov, to 'frame.mov':
Metadata:
encoder : Lavf56.18.100
Stream #0:0: Video: png (png / 0x20676E70), rgba, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc56.20.100 png
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> png (native))
Press [q] to stop, [?] for help
frame= 5 fps=0.0 q=0.0 size= 5321kB time=00:00:00.10 bitrate=435924
frame= 7 fps=6.6 q=0.0 size= 8869kB time=00:00:00.16 bitrate=435922
frame= 11 fps=5.9 q=0.0 size= 15964kB time=00:00:00.30 bitrate=435922
frame= 13 fps=5.4 q=0.0 size= 19512kB time=00:00:00.36 bitrate=435922
frame= 17 fps=5.5 q=0.0 size= 26607kB time=00:00:00.50 bitrate=435922
frame= 19 fps=5.1 q=0.0 size= 30154kB time=00:00:00.56 bitrate=435921
frame= 23 fps=5.3 q=0.0 size= 37249kB time=00:00:00.70 bitrate=435922
frame= 25 fps=5.0 q=0.0 size= 40797kB time=00:00:00.76 bitrate=435921
frame= 29 fps=5.1 q=0.0 size= 47892kB time=00:00:00.90 bitrate=435921
frame= 31 fps=4.9 q=0.0 size= 51439kB time=00:00:00.96 bitrate=435921
frame= 35 fps=4.9 q=0.0 size= 58534kB time=00:00:01.10 bitrate=435921
frame= 37 fps=4.9 q=0.0 size= 62082kB time=00:00:01.16 bitrate=435921
frame= 41 fps=4.9 q=0.0 size= 69177kB time=00:00:01.30 bitrate=435921
frame= 43 fps=4.8 q=0.0 size= 72725kB time=00:00:01.36 bitrate=435921
frame= 47 fps=4.9 q=0.0 size= 79820kB time=00:00:01.50 bitrate=435921
frame= 49 fps=4.7 q=0.0 size= 83367kB time=00:00:01.56 bitrate=435921
frame= 53 fps=4.9 q=0.0 size= 90462kB time=00:00:01.70 bitrate=435921
frame= 55 fps=4.7 q=0.0 size= 94010kB time=00:00:01.76 bitrate=435921
frame= 60 fps=4.8 q=0.0 size= 102879kB time=00:00:01.93 bitrate=435921
frame= 63 fps=4.7 q=0.0 size= 108200kB time=00:00:02.03 bitrate=435921
frame= 66 fps=4.7 q=0.0 size= 113521kB time=00:00:02.13 bitrate=435921
frame= 69 fps=4.7 q=0.0 size= 118843kB time=00:00:02.23 bitrate=435921
frame= 73 fps=4.7 q=0.0 size= 125938kB time=00:00:02.36 bitrate=435921
frame= 78 fps=4.7 q=0.0 size= 134807kB time=00:00:02.53 bitrate=435921
frame= 81 fps=4.7 q=0.0 size= 140128kB time=00:00:02.63 bitrate=435921
frame= 84 fps=4.7 q=0.0 size= 145449kB time=00:00:02.73 bitrate=435921
frame= 87 fps=4.7 q=0.0 size= 150770kB time=00:00:02.83 bitrate=435921
frame= 90 fps=4.7 q=0.0 size= 156092kB time=00:00:02.93 bitrate=435921
frame= 90 fps=4.6 q=0.0 Lsize= 159640kB time=00:00:03.00 bitrate=435924.5kbits/s dup=15 drop=0
video:159639kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000662%
alexandrov@ThinkPad-Edge:~/Documents/training 20150109/edit$ ffmpeg -pattern_type glob -i 'angle/*.png' -r 30 -pix_fmt rgba -vcodec png z.mov >> log.txt
ffmpeg version 2.5.git Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 11 2015 19:12:34 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/home/alexandrov/ffmpeg_build --extra-cflags=-I/home/alexandrov/ffmpeg_build/include --extra-ldflags=-L/home/alexandrov/ffmpeg_build/lib --bindir=/home/alexandrov/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
libavutil 54. 16.100 / 54. 16.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 18.100 / 56. 18.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 7.100 / 5. 7.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, image2, from 'angle/*.png':
Duration: 00:00:03.24, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba64be, 1280x720 [SAR 72:72 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'z.mov' already exists. Overwrite ? [y/N] y
Output #0, mov, to 'z.mov':
Metadata:
encoder : Lavf56.18.100
Stream #0:0: Video: png (png / 0x20676E70), rgba, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 15360 tbn, 30 tbc
Metadata:
encoder : Lavc56.20.100 png
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> png (native))
Press [q] to stop, [?] for help
frame= 6 fps=0.0 q=0.0 size= 363kB time=00:00:00.13 bitrate=22310.
frame= 12 fps= 11 q=0.0 size= 1105kB time=00:00:00.33 bitrate=27156.
frame= 18 fps= 11 q=0.0 size= 1803kB time=00:00:00.53 bitrate=27698.
frame= 24 fps= 10 q=0.0 size= 2576kB time=00:00:00.73 bitrate=28777.
frame= 30 fps= 10 q=0.0 size= 3282kB time=00:00:00.93 bitrate=28809.
frame= 36 fps= 10 q=0.0 size= 4100kB time=00:00:01.13 bitrate=29634.
frame= 42 fps= 10 q=0.0 size= 4829kB time=00:00:01.33 bitrate=29672.
frame= 48 fps= 10 q=0.0 size= 5586kB time=00:00:01.53 bitrate=29844.
frame= 54 fps= 10 q=0.0 size= 6441kB time=00:00:01.73 bitrate=30443.
frame= 59 fps= 10 q=0.0 size= 7154kB time=00:00:01.90 bitrate=30846.
frame= 65 fps= 10 q=0.0 size= 8010kB time=00:00:02.10 bitrate=31244.
frame= 69 fps= 10 q=0.0 size= 8580kB time=00:00:02.23 bitrate=31471.
frame= 75 fps= 10 q=0.0 size= 9435kB time=00:00:02.43 bitrate=31763.
frame= 81 fps= 10 q=0.0 size= 10290kB time=00:00:02.63 bitrate=32012.
frame= 87 fps= 10 q=0.0 size= 11146kB time=00:00:02.83 bitrate=32225.
frame= 93 fps= 10 q=0.0 size= 12001kB time=00:00:03.03 bitrate=32410.
frame= 97 fps= 10 q=0.0 Lsize= 12857kB time=00:00:03.23 bitrate=32575.6kbits/s dup=16 drop=0
video:12856kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.009313%
alexandrov@ThinkPad-Edge:~/Documents/training 20150109/edit$ ffmpeg -i frame.mov -i z.mov -filter_complex "[0:0][1:0]overlay[out]" -shortest -map [out] -pix_fmt rgba -vcodec png test.mov >> log.txt
ffmpeg version 2.5.git Copyright (c) 2000-2015 the FFmpeg developers
built on Jan 11 2015 19:12:34 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/home/alexandrov/ffmpeg_build --extra-cflags=-I/home/alexandrov/ffmpeg_build/include --extra-ldflags=-L/home/alexandrov/ffmpeg_build/lib --bindir=/home/alexandrov/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree --enable-x11grab
libavutil 54. 16.100 / 54. 16.100
libavcodec 56. 20.100 / 56. 20.100
libavformat 56. 18.100 / 56. 18.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 7.100 / 5. 7.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'frame.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf56.18.100
Duration: 00:00:03.00, start: 0.000000, bitrate: 435924 kb/s
Stream #0:0(eng): Video: png (png / 0x20676E70), rgba, 1280x720 [SAR 1:1 DAR 16:9], 435921 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : DataHandler
encoder : Lavc56.20.100 png
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'z.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf56.18.100
Duration: 00:00:03.23, start: 0.000000, bitrate: 32568 kb/s
Stream #1:0(eng): Video: png (png / 0x20676E70), rgba, 1280x720 [SAR 1:1 DAR 16:9], 32572 kb/s, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
Metadata:
handler_name : DataHandler
encoder : Lavc56.20.100 png
Output #0, mov, to 'test.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf56.18.100
Stream #0:0: Video: png (png / 0x20676E70), rgba, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
encoder : Lavc56.20.100 png
Stream mapping:
Stream #0:0 (png) -> overlay:main
Stream #1:0 (png) -> overlay:overlay
overlay -> Stream #0:0 (png)
Press [q] to stop, [?] for help
frame= 3 fps=0.0 q=0.0 size= 1717kB time=00:00:00.03 bitrate=421888
frame= 5 fps=3.8 q=0.0 size= 5212kB time=00:00:00.10 bitrate=427001
frame= 7 fps=3.7 q=0.0 size= 8720kB time=00:00:00.16 bitrate=428613
frame= 8 fps=3.3 q=0.0 size= 10475kB time=00:00:00.20 bitrate=429061
frame= 11 fps=3.7 q=0.0 size= 15746kB time=00:00:00.30 bitrate=429972
frame= 13 fps=3.7 q=0.0 size= 19264kB time=00:00:00.36 bitrate=430381
frame= 13 fps=3.2 q=0.0 size= 19264kB time=00:00:00.36 bitrate=430381
frame= 15 fps=3.1 q=0.0 size= 22781kB time=00:00:00.43 bitrate=430672
frame= 17 fps=3.1 q=0.0 size= 26297kB time=00:00:00.50 bitrate=430857
frame= 19 fps=3.0 q=0.0 size= 29814kB time=00:00:00.56 bitrate=431000
frame= 21 fps=3.1 q=0.0 size= 33331kB time=00:00:00.63 bitrate=431122
frame= 23 fps=3.1 q=0.0 size= 36848kB time=00:00:00.70 bitrate=431228
frame= 25 fps=3.1 q=0.0 size= 40367kB time=00:00:00.76 bitrate=431328
frame= 27 fps=3.2 q=0.0 size= 43884kB time=00:00:00.83 bitrate=431399
frame= 29 fps=3.2 q=0.0 size= 47402kB time=00:00:00.90 bitrate=431466
frame= 31 fps=3.2 q=0.0 size= 50923kB time=00:00:00.96 bitrate=431548
frame= 33 fps=3.2 q=0.0 size= 54449kB time=00:00:01.03 bitrate=431655
frame= 36 fps=3.3 q=0.0 size= 59741kB time=00:00:01.13 bitrate=431822
frame= 38 fps=3.3 q=0.0 size= 63267kB time=00:00:01.20 bitrate=431903
frame= 40 fps=3.3 q=0.0 size= 66794kB time=00:00:01.26 bitrate=431981
frame= 43 fps=3.3 q=0.0 size= 72080kB time=00:00:01.36 bitrate=432055
frame= 46 fps=3.4 q=0.0 size= 77365kB time=00:00:01.46 bitrate=432117
frame= 48 fps=3.4 q=0.0 size= 80889kB time=00:00:01.53 bitrate=432159
frame= 50 fps=3.4 q=0.0 size= 84414kB time=00:00:01.60 bitrate=432197
frame= 53 fps=3.5 q=0.0 size= 89700kB time=00:00:01.70 bitrate=432248
frame= 55 fps=3.4 q=0.0 size= 93224kB time=00:00:01.76 bitrate=432279
frame= 57 fps=3.4 q=0.0 size= 96749kB time=00:00:01.83 bitrate=432308
frame= 58 fps=3.3 q=0.0 size= 98511kB time=00:00:01.86 bitrate=432322
frame= 60 fps=3.4 q=0.0 size= 102035kB time=00:00:01.93 bitrate=432348
frame= 63 fps=3.4 q=0.0 size= 107322kB time=00:00:02.03 bitrate=432383
frame= 64 fps=3.4 q=0.0 size= 109084kB time=00:00:02.06 bitrate=432394
frame= 66 fps=3.4 q=0.0 size= 112608kB time=00:00:02.13 bitrate=432415
frame= 69 fps=3.4 q=0.0 size= 117895kB time=00:00:02.23 bitrate=432445
frame= 71 fps=3.4 q=0.0 size= 121419kB time=00:00:02.30 bitrate=432463
frame= 73 fps=3.4 q=0.0 size= 124943kB time=00:00:02.36 bitrate=432480
frame= 75 fps=3.4 q=0.0 size= 128468kB time=00:00:02.43 bitrate=432496
frame= 77 fps=3.4 q=0.0 size= 131992kB time=00:00:02.50 bitrate=432511
frame= 79 fps=3.4 q=0.0 size= 135516kB time=00:00:02.56 bitrate=432526
frame= 81 fps=3.4 q=0.0 size= 139041kB time=00:00:02.63 bitrate=432540
frame= 83 fps=3.4 q=0.0 size= 142565kB time=00:00:02.70 bitrate=432553
frame= 85 fps=3.4 q=0.0 size= 146089kB time=00:00:02.76 bitrate=432565
frame= 87 fps=3.4 q=0.0 size= 149614kB time=00:00:02.83 bitrate=432577
frame= 89 fps=3.4 q=0.0 size= 153138kB time=00:00:02.90 bitrate=432588
frame= 91 fps=3.4 q=0.0 size= 156663kB time=00:00:02.96 bitrate=432599
frame= 91 fps=3.3 q=0.0 Lsize= 160188kB time=00:00:03.03 bitrate=432613.9kbits/s dup=0 drop=6
video:160187kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000884%
alexandrov@ThinkPad-Edge:~/Documents/training 20150109/edit$