1. Linux
äžè¬ã«ããã¡ãããmanycam.comã®ãããªãŠãŒãã£ãªãã£ãããŠã³ããŒãããŠãWindowsã®äžéšã®æ©èœã«ã¢ã¯ã»ã¹ã§ããŸãã ããã...ãããã®å¯èœæ§ã¯ãå€æ§ã§ã¯ãããŸããããã®ããã°ã©ã ã®äœè ãšãã©ã°ã€ã³ã®äœè ã®æå¿ã«ãã£ãŠå¶éãããŠããŸãã ãããã®ãã©ã°ã€ã³ãæžãã®ã¯ããã»ã©ç°¡åã§ã¯ãããŸããã ãããŠãæ å ±åŠçã®å²åŠãšããŠããããã®ã¿ã¹ã¯ã«LinuxãšunixwayãåªããŠããã®ã¯ãããŸããŸãªçšåºŠã®fun'ovityã®ããããçš®é¡ã®ãã£ã«ã¿ãŒãéåžžã«ç°¡åãã€æè»ã«çµåããæçµçã«èå³æ·±ãçµæãåŸãããšãã§ãããšããããšã§ãã ããå€ãã®èªç±ãããã®ã§ãLinuxã§ã¯ä»¥äžã®ãã¹ãŠãå±éãããŠããŸãã ãããããã¡ãããWindowsãŠãŒã¶ãŒããå°ãªããšãåãManyCam.comã®å©ããåããŠãããŸããŸãªçš®é¡ã®ãã£ããã«ãŒã¬ããã®éäºã«åå ããå¿ èŠããããŸãã
2. avldããã³vloopback
æåã«è¡ãããšã¯ãããããã¹ãŠã®ãã£ããã«ãŒã¬ãããæ©èœãããã©ãã·ã¥ãã¬ãŒã€ãŒãšã®ãããªã€ã³ã¿ãŒãã§ã€ã¹ã確ç«ããããšã§ãã Linuxäžã®Flashplayerã¯video4linuxïŒ2ïŒãµãã·ã¹ãã ã®ãããªããã€ã¹ãç解ããããããã®ãããªä»®æ³ããã€ã¹ãæŽçããå¿ èŠããããŸãã ããã¯ãç¹å¥ãªãã©ã€ããŒã䜿çšããŠå®è¡ã§ããŸãã ãããã®å€ãã¯èéã«ãããŸãããç§ã¯å人çã«ã¯avldãšvloopbackã®ã¿ãåäœãããããšãã§ããŸããã å€ããå°ãªãããã«ãŒãã«ããŒãžã§ã³2.6.33.4ã§ãåäœããŸãã å¥ã®ãã©ã¹ã¯ããããã®ãã©ã€ããŒïŒç§ã®ç¥ãéãïŒãUbuntuãªããžããªã«å«ãŸããŠããããšããããŠïŒç¢ºãã«ïŒAUR Arch Linuxã«ãããããããGentooã«ãããããšã§ãããããã£ãŠãã·ã¹ãã ã«æ£ããã€ã³ã¹ããŒã«ããã®ã¯ç°¡åã§ãã ïŒèªå·±çµã¿ç«ãŠãè¡ãå¿ èŠã¯ãããŸããã ãããã®ããã±ãŒãžãã€ã³ã¹ããŒã«ããæ¹æ³ã説æããæéãç¡é§ã«ããŸããããããã«è³ªåã®çãã«æ»ããŸãïŒãªã2ã€ã®ãã©ã€ããŒã«ã€ããŠè©±ããŠããã®ã§ããïŒ
çãã¯ããã§ãã ã»ãšãã©ã®æ¥œããã·ããªãªã§ã¯ãavldã§ååã§ã-å¬ã®ãã§ã«ãããŒãã®ããã«éåžžã«äœ¿ãããããä¿¡é Œæ§ãé«ãã§ãããé倧ãªæ¬ ç¹ããããŸãïŒavldïŒãããŸã§ïŒã¯å€ãã®ãããªããã€ã¹ããµããŒãããã1ã€ã®ä»®æ³v4lããã€ã¹ã®ã¿ãäœæãããŸããã©ã€ããŒã®ããŠã³ããŒããããã¯ååã§ã¯ãããŸããã vloopbackã䜿çšãããšãå€ãã®ããã€ã¹ïŒãããªãã€ãïŒãäœæã§ããŸãããåæã«Flashplayerããã©ãŠã¶ãŒã§ãã£ãããšäžæåæ¢ããããšãã§ããããªãã·ã£ãŒããã¹ãã£ãã¯ãªã·ããªãªã«åŸã£ãŠäœ¿çšããå¿ èŠããããŸãã ãã¡ãããè€éããæ°ã«ããã«vloopbackã®ã¿ã䜿çšããããšãã§ããŸããããã1ã€ã®é倧ãªæ¬ ç¹ããããŸãããã®ãããªã¹ããªãŒã ãèªã¿åãããã»ã¹ãåä¿¡ã§ããé床ã§ãããªã¹ããªãŒã ãçæããfpsã¯ãŸã£ããå¶åŸ¡ãããŸããã ãããªã¹ããªãŒã ããã»ã¹ãçæãããŠããå Žåã§ãããã¬ãŒã ãçæããããšã¯ã»ãšãã©ãããŸããããã®å Žåãvloopbackã¯ãã°ããã®éåããã¬ãŒã ãçæããŸãã ãã®ãããvloopbackããã€ã¹ã䜿çšããå Žåãfireplayerãä»ããfirefoxã¯100ïŒ CPUè±ã«ãªããŸãã ãããã£ãŠãã©ãããããã§vloopbackã楜ããã§ããå Žåã¯ãããã»ããµãçé»åã¢ãŒãã«ããã®ãçã«ããªã£ãŠããŸããããããªããšãã·ã¹ãã ã¯ããŸãã¡ãªãããªããŠã©ãŒã ã¢ããããŸãã
avldã§ã¯ãfpsãèšå®ã§ããŸããããã«ãããflashplayerã®CPUã®å€§é£ããå¶éããããããªãå¶åŸ¡ããè¿œå ã®æ©èœããããŸãã
ããã§ããã©ã€ããŒãã€ã³ã¹ããŒã«ããŸããã次ã«äœãããŸããïŒ
1.1ã avld
ãŸãããã©ã€ããŒãããŠã³ããŒãããå¿ èŠããããŸãã ããŒã ã§ãã£ãšããŸããã
modprobe avldå¹ = 320é«ã= 240 fps = 30
ãã®åŸãããã€ã¹
/dev/videoN
ãã·ã¹ãã ã«è¡šç€ºãããã¯ãã§ããããã§ãçªå·Nã¯ã·ã¹ãã å ã®æ¢åã®v4lããã€ã¹ã®æ°ã«äŸåããŸãã çè«çã«ã¯ãLinuxãã£ã¹ããªãã¥ãŒã·ã§ã³ã®æšæºã«ããã°ã
video
ã°ã«ãŒãã®ãŠãŒã¶ãŒã¯ãã®ããã€ã¹ãžã®èªã¿åãããã³æžã蟌ã¿ã¢ã¯ã»ã¹æš©ãæã£ãŠããå¿ èŠããããããå¿ ãèªåèªèº«ãè¿œå ããŠãã ããã
ã¢ãžã¥ãŒã«ãã©ã¡ãŒã¿ãŒã«ç€ºãããŠããçªå·ãæ確ã§ããå¿ èŠããããŸãããŸããavldã®ããã¥ã¡ã³ãã«ã¯ã
/dev/videoN
æ°ããæ§æãæžã蟌ããšããããã®ãã©ã¡ãŒã¿ãŒãå®è¡æã«å€æŽã§ããããšãèšèŒãããŠããŸãã
echo 'width = 640 height = 320 fps = 15'> / dev / videoN
ãããããã®æ¹æ³ã§ã¯èšå®ãå€æŽã§ããŸããã§ããã ãã ããã¢ãžã¥ãŒã«ããªããŒãããã ãã§å€æŽã§ããŸãã
ã¢ãžã¥ãŒã«ãå¿ èŠãªãã©ã¡ãŒã¿ãŒïŒããã³flashplayer 320x240 25fpsã®å Žåãä»ã®ãµã€ãºã§ãåäœããŸãïŒã§èªã¿èŸŒãã åŸãããã«ãã©ãŠã¶ãŒãèµ·åããchatroulette.comã«ã¢ã¯ã»ã¹ããå³ããŠã¹ãã¿ã³ã§ãã©ãã·ã¥ãã©ã°ã€ã³é åãçªããŠãèšå®ã«è¡šç€ºãããã«ã¡ã©ãéžæã§ããŸãïŒãã®ååã¯ããããŒãããªããã€ã¹ããšããåèªã§å§ãŸããŸãïŒã
ã«ã¡ã©ã®é»æºãå ¥ãããšãã»ãŒèªåã®äœåã®é»ãåè§ãèŠããã¯ãã§ãã ãã€ã³ãã§å¡ãã€ã¶ãã«ã¯ãçã®ç»åãé çªã«æžã蟌ãå¿ èŠããããŸããã€ãŸãããã¯ã»ã«ã®è²ãdevice
/dev/videoN
ãšã³ã³ãŒãããäžé£ã®å€ã ããæžã蟌ãå¿ èŠããããŸãã 次ã®æ¹æ³ã§å®è¡ã§ããŸãã
ffmpeg -an -i some_video.avi -f rawvideo -s 320x240 -pix_fmt bgr24-| dd obs = $ïŒïŒ320 * 240 * 3ïŒïŒof = / dev / videoN
ã€ãŸããç¹å®ã®ãããªãã¡ã€ã«ãååŸããããããããããªã¹ããªãŒã ãæœåºããïŒ
-an
ã«ãªãŒãã£ãªãã©ãã¯ã«æ³šæãæããªãããã«æ瀺ããŸãïŒãé©åãªãµã€ãºã®çç»åã®ã·ãŒã±ã³ã¹ã«ãã³ãŒãããããã¯ã»ã«ã«é¢ããè²æ å ±ã®æãŸãã圢åŒã§ããããã¯å šäœã«èšé²ãããŸããµã€ãºïŒ320 * 240 * 3ïŒãã€ããavldã
ffmpegããã¹ããªãŒã ãããã«
/dev/videoN
ãšã察å¿ãããã¡ã€ã«èšè¿°åã䜿çšããŠ
write
åå¥ã®åŒã³åºãã«ãã£ãŠavldãåãã¬ãŒã ãå®å šã«æäŸããffmpegããã®åºåãããããæ°ãããã€ãã§å°ããªéšåã«æžã蟌ãããã ãavldã¯ãã¬ãŒã å šäœãåãåããšèããŸãããåæã«å°ããªæçã®ã¿ãåãåããŸãããã®ãããäœããã®ãridgeãé ããŸãã äžèšãä¿®æ£ããddã䜿çšããŠãobsãªãã·ã§ã³ã¯ãåºåãã¡ã€ã«ã§ããŒã¿ãåºåãããããã¯ãæ瀺ããŸãã ã€ãŸããããã§ddã¯ããã¬ãŒã ã«é¢ããå®å šãªæ å ±ãèç©ãããããã¡ãŒãšããŠäœ¿çšããããããavldã®äžå¯è§£ãªãããã¯ãšããŠåãåºããŸãã
å®éããã¹ãŠãavldã«ãããŸãã
/dev/videoN
äœã§ãæžã蟌ãããšãã§ããŸãã ãŸããavldãæåŸã®ãã¬ãŒã ãèšæ¶ãããã®v4lããã€ã¹ããã®ãããªã¹ããªãŒã ãæ¶è²»ããã¢ããªã±ãŒã·ã§ã³ã«ãããæäŸããããšã圹ç«ã¡ãŸãã ãããã£ãŠã
/dev/videoN
ã«1æã®åçãèšé²ããããšãã§ãããã£ããã«ãŒã¬ããã®äœæ°ã®ããŸãã¯ã£ããããªãèŠç·ã®åã«è¡šç€ºãããŸãã
ãšããã§ãã¯ãã MEncoderã¯ããããªãã³ãŒãã®çµæããã¬ãŒã ããšã«ç圢åŒã§æžã蟌ããããddãªãã§äœ¿çšã§ããŸãã
1.2ã vloopback
ãã®ããšã®ã€ã³ã¿ãŒãã§ãŒã¹ã¯ãavldã«æ¯ã¹ãŠã¯ããã«è€éã§ãã ãã®çç±ã¯ãvloopbackã¯åœã®ãããªã«ã¡ã©ãšããŠã§ã¯ãªãããªã¢ã«ã¿ã€ã ãããªåŠççšã®ãã€ãïŒbashã§|ïŒã®ãããªããã€ã¹ãšããŠèããããŠããããã§ãã ãã®ç¹ã§ããã®ãã®ã«ã¯ããªãæŽç·Žããããªãã·ã§ã³ã®ã»ããããããããªãè€éãªããã°ã©ã ã€ã³ã¿ãŒãã§ã€ã¹ããããç¹å¥ãªãŠãŒãã£ãªãã£ã䜿çšããŠãããã®éåžžã«ãããªãã€ãã®ãã©ã¡ãŒã¿ãŒãæ§æããå¿ èŠããããŸããããšãã°ããããªãã¹ã±ãŒãªã³ã°ã§ããŸãïŒã«ãŒãã«å ã§ãã¯ã... LinuxãçºçããŸãïŒå€ïŒ ããããvloopbackã®è€éãããã¹ãŠç解ããã®ã§ã¯ãªãã楜ãã¿ãåŸãããšãç®çã§ããã°ãç°¡åãªæ¹æ³ã§è¡åã§ããŸãã
ãã¡ãããæåã«ãã¢ãžã¥ãŒã«ãã«ãŒãã«ã«ããŒãããå¿ èŠããããŸãã
modprobe vloopback pipes=M
ããã§ãpipesãã©ã¡ãŒã¿ãŒã䜿çšããŠvloopbackãèŠæ±ããé©åãªæ°ã®ãã€ããäœæã§ããŸãã ããŒãåŸãvloopbackã¯ã察å¿ãããã£ãã«ã®å ¥åããã³åºåã®ååã
/dev
é 眮ãããå Žæãéç¥ããŸãã ãã®æ å ±ã¯æ¬¡ã®ããã«è¡šç€ºã§ããŸãã
$ dmesg | grep vloop [vloopback_init]ïŒvideo4linuxã«ãŒãããã¯ãã©ã€ããŒv1.4-trunk [vloopback_init]ïŒã«ãŒãããã¯0ç»é²ãå ¥åïŒvideo0ãåºåïŒvideo1 [vloopback_init]ïŒã«ãŒãããã¯0ã2ã€ã®ãããã¡ãŒãäœ¿çš [vloopback_init]ïŒã«ãŒãããã¯1ãç»é²ãããå ¥åïŒvideo2ãåºåïŒvideo3 [vloopback_init]ïŒã«ãŒãããã¯1ã2ã€ã®ãããã¡ãŒã䜿çš
åãã£ãã«ã«ã¯
/dev
2ã€ã®ååããããv4lããã€ã¹ã®ãµããããŠããŸãããã¡ããããã£ãã«ã®åºåã§ããããã®ããã€ã¹ã®ããŒã¿ã¯å ¥åã«æžã蟌ãŸããŸãã ãã ããvloopbackãã£ãã«ãžã®æžã蟌ã¿ãããã³ã«ã¯ãåçŽã§ã¯ãããŸãããavldã®å Žåã®ããã«ç°¡åã§ã¯ãªãããã£ãã«ã«äžé£ã®ãã¬ãŒã ãæžã蟌ãã«ã¯ã
mjpegtools_yuv_to_v4l
ãšããååã®ãŠãŒãã£ãªãã£ã䜿çšããå¿ èŠããããŸãã ãã®ããã±ãŒãžã¯ãªããžããªãšAUR Arch Linuxã«ã¯ãªãã®ã§ãå人çã«ãã®ãŠãŒãã£ãªãã£ããœãŒã¹ããã³ã³ãã€ã«ããå¿ èŠããããŸãããããã¯éåžžã«ç°¡åã§ãïŒïŒ1ïŒãœãŒã¹www.filewatcher.com/m/mjpegtools_yuv_to_v4l-0.2.tgz.11065.0.0.html ïŒ 2ïŒ
make
å®è¡ã
make
ã
ããã§ããããªã¹ããªãŒã ãvloopbackãã£ãã«ã«éä¿¡ããæºåããã¹ãŠæŽããŸããã ãã ããvloopbackã«ã¯ç©ãããªåŠçãå¿ èŠã§ãããããäœããã³ã°ããªãããã«ããã«ã¯ãããã€ãã®ã«ãŒã«ã«åŸãå¿ èŠããããŸãã ãŸããæåã«ãããªã¹ããªãŒã ãæåã«vloopbackã§éå§ããŠããããããªããã€ã¹ããããŒã¿ãèªã¿åãã¢ããªã±ãŒã·ã§ã³ãå®è¡ããå¿ èŠããããŸãã åäœãåæ¢ããã«ã¯ãæåã«èªã¿åããããã³ããŒã¿ãvloopbackãã£ãã«ã«æžã蟌ãã¢ããªã±ãŒã·ã§ã³ãéããå¿ èŠããããŸãã èŠããã«ãã¹ã¿ãã¯ã®ããã«ã
ããã«ãvloopbackã§ã¯ããã¯ã»ã«ã®ãžãªã¡ããªãšè¡šç€ºåœ¢åŒã調æŽããå¿ èŠããããŸããããã¯ãmplayerã䜿çšããŠå®è¡ã§ããŸãã ãã®ãããæåã«vloopbackãã£ãã«ãžã®ãããªã¹ããªãŒã ïŒ
ffmpeg -an -i some_file.avi -f yuv4mpegpipe -s 320x240 -pix_fmt yuv420p-| mjpegtools_yuv_to_v4l / dev / video0
ãã®å Žåãflashpluginã®ãããã©ãŠã¶ãŒã¯èµ·åããªãã§ãã ããã ãã£ããã«ãŒã¬ãããéãåã«ããããªãã£ãã«ã®åºååŽãæ§æ/確èªããå¿ èŠããããŸãã ããã¯ãmplayerã䜿çšããŠå®è¡ã§ããŸãã
mplayer tvïŒ// -tv 'driver = v4lïŒwidth = 320ïŒheight = 240ïŒdevice = / dev / video1'
mplayerãå®äºãããšããã£ããã«ãŒã¬ããã䜿çšããŠãã©ãŠã¶ãŒãèµ·åããæ°çå ã®ä»®æ³ã«ã¡ã©ãéžæã§ããŸãã èŠããŠãããŠãã ããïŒäœããã³ã°ããªãããã«ãæåã«ãã©ãŠã¶ãéããïŒãŸãã¯flashpluginãç¡å¹ã«ããïŒå¿ èŠããããŸãããã®åŸããã£ã³ãã«å ã®ãã¬ãŒã ã®èšé²ãåæ¢ããŸãã
2.ã³ã³ãã³ãã
ãã®ãããflashpluginã«ãã£ãŠèªèãããä»®æ³ã«ã¡ã©ã¯ããã®æ¹æ³ãç¥ãããŠããŸãã ããããããããåããæ¹æ³-ãããåé¡ã§ãã äžè¬çã«ãããããã¹ãŠå§ãããšããç§ã¯ãã§ãã¯ãããéã欲æ±ããããŸããïŒç§ã®é¡ãæ²ãã£ãŠãããããããã®ã·ã£ããŒã«ã§äººã ãåžžã«æ¬¡ã®ãã¿ã³ã§çªãããã«ããã«åº§ã£ãŠããŸãã
ãããã£ãŠãç§ãæåã«ãããã£ãã®ã¯ã2人ã®ãŠãŒã¶ãŒéã®ãäžéè ãã«ãªãããšãã€ãŸããæåãã2çªç®ã®ãããªã¹ããªãŒã ããããŒããã£ã¹ãããããšã§ããã ãããããäºåã«ããŒããããã©ã€ãã©ãªãä»ããŠããã®ãããªã¹ããªãŒã ã®èåŸã®flashpluginã«ã¢ã¯ã»ã¹ã§ããŸãããé·ããŠå°é£ã§ãã ç»é¢ããå®æããåçãæ®ãæ¹ãç°¡åã§ãã ffmpegã¯ããã«åœ¹ç«ã¡ãŸãïŒavldã®å ŽåïŒïŒ
ffmpeg -f x11grab -s 320x240 -r 15 -iïŒ0.0 + x_offset + y_offset -f rawvideo -pix_fmt bgr24-| dd obs = $ïŒïŒ320 * 240 * 3ïŒïŒof = / dev / videoN
-r
ãã©ã¡ãŒã¿ãŒã¯ãfpsïŒç»é¢ãããã¬ãŒã ãååŸããé »åºŠïŒãèšå®ããŸãã ãããŠãæ£ãããã©ã¡ãŒã¿x_offsetãšy_offsetãæ°åéžæãããšãç®çã®çžäºç¿»èš³ãéæããããã«ãã£ãŠæ°åãå°ç¡ãã«ããããšãã§ããŸãããªããªãã圌ãã¯ç®ã®åã«èª°ãããŠãïŒããã¯ããããã®ãã¹ãŠã®ã·ã£ããŒã«ããããã€ãã®ãã¿ã³ã®ããéãççšãæãã§ããããŠã¹ãšããŒããŒãã®ã¡ãŒã«ãŒã®é°è¬ã§ãããšãã仮説ãçã¿åºããŸãïŒã ããããããã®è¡åã¯ãã¥ãŒãã³ã®ç¬¬äºæ³åã®ç€ŸäŒçé¡äŒŒç©ã®çŸãã§ããã身äœãåã®ãªãç¶æ ã§ïŒç°å¢ã®å¯Ÿç§°æ§ã®æ¡ä»¶ã§ïŒçŽç·çãã€åäžã«åããšãã§ãã
ããããå¥ã®åé¡ãçºçããŸãïŒäººã ã®æ³šæãåŒãæ¹æ³ïŒã§ããã°ã女ã®åã®æ³šæïŒã äžè¬çã«ãè¯ãç¹ã¯ããã¹ã¯ãããã®ç¿»èš³ïŒããŒã ã®å§ãŸãã§ãããããã¯ã«ããŸã詳ãããªã人ã«ãšã£ãŠïŒã§ãã
ffmpeg -f x11grab -s 1680x1050 -r 15 -iïŒ0.0 ...
ããšãã°ããã§ã¹ã®ã²ãŒã ãå ¬éãããŠããããå€å°ãªããšãç¥çã§ãã ãã¡ããããã¹ã¯ãããã«ã¯ãæããææ ®æ·±ãé¡ãæçš¿ããŠãå¥ã®ãŠã£ã³ããŠã«å®éã®ã«ã¡ã©ããã®ãããªã¹ããªãŒã ã衚瀺ããããšãã§ããŸãã
mplayer -nosound tvïŒ//
ããããéãããã¯ã·ã§ã³ãŠã£ã³ããŠãå¹²æžãããããã¡ã¢ãªå ã®ããŸããŸãªãããªã¹ããªãŒã ããªãŒããŒã¬ã€ããããããä»®æ³Webã«ã¡ã©ã«éä¿¡ããããšããèŠæããããŸãã ãã¡ããããããè¡ããŠãŒãã£ãªãã£ãèŠã€ããããšãã§ããŸãããX-Windowèªäœãäœãã«äœãã課ãè¯ãæ©äŒãæäŸããããšãæãåºãããšãã§ããŸãã
3. xvfb
ä»®æ³ãã¬ãŒã ãããã¡ã«æç»ã§ããããã«ãããã¯ãããã¡ã§ãããã¡ãããæåã«äœæããŠå®è¡ããå¿ èŠããããŸãïŒ
XvfbïŒ1ç»é¢1 640x480x32
ããã«ãããæ°ããç»é¢1ã§ä»®æ³ãã£ã¹ãã¬ã€1ãäœæãããŸãã解å床ãšè²ã®æ·±ãã¯ãã©ã®ç»é¢ã§æ確ã«ãªãã¯ãã§ãïŒYodaãã¹ã¿ãŒïŒã ãŸããããã ãã§ãã ããã«ã¯æããã§ãã ãã¹ã¯ãããã®ãããªã¹ããªãŒã ããã®ä»®æ³ãã£ã¹ãã¬ã€ã«éä¿¡ã§ããŸãã
export DISPLAY =ïŒ1.1; ffmpeg -f x11grab -s 1680x1050 -r 15 -iïŒ0.0 -f yuv4mpegpipe -pix_fmt yuv444p -s 640x480-| ffplay -f yuv4mpegpipe-
åæåæã®ffplayã¯DISPLAYç°å¢å€æ°ãåç §ããã©ã®XãµãŒããŒãæç»ãããŠããããç解ããŸãïŒããã§ã¯yuv4mpegpipeã䜿çšããŠãã€ãã®åä¿¡åŽã§ããå°ãªãããŒãèšè¿°ããŸãããè²ãyuv444ã«å€æããŠãããåçã¯CPUè² è·ãå¢å ãããããã-f rawvideoã䜿çšããæ¹ãå¹ççã§ããããã¯ã»ã«åœ¢åŒãšãã¬ãŒã ãµã€ãºãã©ãã§ãæå®ããå¿ èŠããããŸãïŒã 次ã«ããã®æ··ä¹±ã«ãããªç»åããªãŒããŒã¬ã€ã§ããŸãã
mplayer -nosound tvïŒ// -tv 'width = 160ïŒheight = 120' -displayïŒ1.1 -geometry + $ïŒïŒ640-160-10ïŒïŒ+ $ïŒïŒ320-120-10ïŒïŒ
ããŠããããªã¹ããªãŒã ãä»®æ³ãããªã«ã¡ã©ã«éä¿¡ããŸãã
ffmpeg -f x11grab -s 640x480 -r 15 -iïŒ1.1 -f rawvideo -s 320x240 ...
ããããŸãããçŸæç¹ã§ã¯ãåçã®äžã«åçããããŸãããã§ã¹ã®èœåãªã©ãä»ã®äººã«ç€ºãããšãã§ããŸãã ãªã© ããããæ®å¿µãªãããçŸå®ã¯éé ·ã§ãã«ãçãªãã®ã§ãã ãã£ããã«ãŒã¬ããã«äœãã§ããã»ãšãã©ã®äººïŒå¥³ã®åãå«ãïŒã¯ãã«ããã«ããŠã§ãã«ã¡ã©ã®åã§æããããããªã·ãªãŒãºã«å€¢äžã«ãªã£ãŠããŸãïŒããã人ã ã¯ã®ããèŠã奜ãã§ãïŒã
4.åãæã
ããããã€ã³ã¿ãŒãããã§å ¥æã§ãããããã®ãããªã®ã»ãšãã©ã¯...
ïŒãšããã§ãFirefoxã®ãã©ãã·ã¥ã¡ãã£ã¢ãããããªãåŒãåºãç°¡åãªæ¹æ³ã¯æ¬¡ã®ãšããã§ããçŸåšãflashplayer-10.0.42.5ã¯ãã®ãããªãããªã³ã³ãã³ãã§åäœããŸãããã©ãŠã¶ã®ãã£ãã·ã¥ãããããªã®ããŠã³ããŒããéå§ãããããªã®ãããã¡ãªã³ã°äžã«å¯Ÿå¿ãããã¡ã€ã«ããã£ãã·ã¥ã«ãããŸãfirefoxããããããããã¡ãªã³ã°ãçµäºãããšããã¡ã€ã«ã¯åé€ãããéãããŸãŸã«ãªããflashpluginã¯ãããèªãããšãã§ããŸããããã¡ãããããªãã¯ãã®ãã¡ã€ã«ããã£ã¹ã¯ã«ä¿åããããã®Linux OIDã§ããããªãã¯ãããžã®ããŒããªã³ã¯ãäœæããå¿ èŠããããŸããããã£ãŠããããªãä¿åããå Žåã¯ãããã䜿çšããŠããŒãžãéããid ãã®ããŒããªã³ã¯ã³ãã³ãäœãæ§è³ªã®ãã®ãšãã¹ãŠããææã®æ åãåé€ããŸããã©ãŠã¶ã®ãã£ãã·ã¥ããããã«ã
ln
ç§ãèŠã€ããããªã- ãããããã¹ãŠãã
ãã®ãããã€ã³ã¿ãŒãããäžã®çãããã³ã³ãã³ãã®ã»ãšãã©ã®ãããªã«ã¯ãèŠãŠãã人ã®é¯èŠãç Žå£ããªãããã«ãããŸããŸãªç°ãªãããŽãšã©ã³ãã³ã°ã©ã€ã³ãä»ããŠããŸãã ãã¡ãããå šäœåããããããªãããªçŽ æãåãåã£ãŠãããããåãé€ãå¿ èŠããããŸãã ããã«ã¯ãffmpeg-ããªãã³ã°ãããªãã£ã«ã¿ãŒïŒNashenskyã®ããªãã³ã°ïŒãé©ããŠããŸãã ãããããã®ãã£ã«ã¿ãŒã¯ã²ã©ãæ©èœãã次ã®ããã«èšè¿°ããå ŽåïŒ
ffmpeg -an -i some_video.avi -vf crop = 32ïŒ32ïŒ400ïŒ300 -f rawvideo -s 320x240 ...
次ã«ã座æšïŒleft_up-right_lowïŒïŒ32.32ïŒ-ïŒ432.332ïŒã®ããã¯ã¹ã320x240ãã¬ãŒã ã«åãŸããªããã€ãŸãffmpegãæåã«ãã¬ãŒã ãæ¡å€§çž®å°ããŠããããªãã³ã°ãã£ã«ã¿ãŒãé©çšããããšãããšããäºå®ã«scãããŸãã ãã¡ããã
bc -l
ãå®è¡ããé©åãªãµã€ãºã®ããããªç»åãååŸããããã«å¿ èŠãªãã¹ãŠãèšç®ã§ããŸãããããã¯é¢åã§ãã代ããã«ãã€ãã©ã€ã³ã䜿çšã§ããŸãã
ffmpeg -an -i some_video.avi -vf crop = 32ïŒ32ïŒ400ïŒ300 -f yuv4mpegpipe-| ffmpeg -f yuv4mpegpipe -i--f rawvideo -s 320x240 -pix_fmt ...
ããŠãããã§ã¿ããªã«ãããèšãããšãã§ããŸãïŒããªãã®æ³šæããã£ããã«ãŒã¬ããã®ãªãŒãã³ã¹ããŒã¹ã§ã®å¹žããªãããªåµé ã«æè¬ããŸãã ããããç§ã¯ãŸã å®è·µçã§ãããé·ãéãHabréã«ã¯æžããŸããã§ããã
5. AtomãŠãŒã¶ãŒã
äžè¬çã«ãããããã¹ãŠã®ãšã³ã¿ãŒãã€ã³ã¡ã³ãã§ã¯ãæã匷åã§ã¯ãªãAthlon II X2ã®äžéšã®ããã©ãŒãã³ã¹ã§ååã§ãã ãã®æç¹ã§ããp720解å床ã§ããã€ãã®æ ç»ãïŒåæã«ïŒèŠãããšãã§ããŸãã ããããä»ã§ã¯ã·ã³ã°ã«ã³ã¢ã®Atomããããã²ã©ãåŒã£åŒµã£ãŠããŠãã©ãã«ãããŠäœåãªfpsãçµãåºããããšæããŸãã
ãããŠãããã§ã¯ãããŒããŠã§ã¢ã¹ã¬ããã®å¯Ÿç§°æ§ã«ãããããããããŸããŸãªããã»ã¹ã°ã«ãŒãã®ã¢ãã£ããã£èšå®ã圹ç«ã¡ãŸãã ããã¯ãããããã¹ã±ãžã¥ãŒã©ãããŒããŠã§ã¢ã¹ã¬ãããå®å šã«çãããšã³ãã£ãã£ãšèŠãªããŠåºå¥ããããããã®éã§ããã»ã¹ãèªç±ã«ã¹ããŒãããšããäºå®ã«ãããã®ã§ãã ããããçµå±ã®ãšããããããã®ã¹ã¬ããã®TLBã¯ç°ãªãã¯ãã§ãã ãŸããããã»ã¹ãã¹ããŒããããšããããã®åãTLBã®åŒ·å¶åãæ¿ããçºçããŸãã firefoxã®å®è¡ãffmpegãšæ··ããåã£ãŠããå Žåãx86ã¢ãŒããã¯ãã£å ã§åãæ¿ããè¡ãã«ã¯ãTLBãå®å šã«ãªã»ããããæ°ããããŒã¿ã§ãªããŒãããå¿ èŠããããŸãã
ãããã£ãŠãããªããéãæã€ãšçç£æ§ããããã«åäžããŸã
taskset -c 1 firefox
firefoxã2çªç®ã®ã¹ã¬ããã«ããã¹ãŠã®ãããªã®åŠçã«é¢é£ãããã¹ãŠã®ããã»ã¹ãæåã®ã¹ã¬ããïŒçªå·0ïŒã®ã¹ã¬ããã«è¿œå ããŸãã ãã®æ¹æ³ã§ã1ç§ããã2ã3ãã¬ãŒã ãç²åŸã§ããŸãã
6.ãªãŒãã£ãªã
ããããALSAããä»®æ³ãã€ã¯ãæ§ç¯ããããšã¯ã§ããŸããã§ããã ããã¯ãALSAã«ã¯aloopãšåŒã°ãããã€ãã£ãã«ãŒãããã¯ãã©ã€ããŒããããšããäºå®ã«ããããããã§ãã ãããŠãããã¯æ¬åœã«æåŸ éãã«æ©èœããŸãïŒãã®ãã£ãã«ã®1ã€ã«æžã蟌ãŸãããã¹ãŠã¯ã察å¿ããä»ã®ãã£ãã«ããèªã¿åãããŸãã ãžã£ãã¯ãµãŒããŒã¯ããã§ããŸãæ©èœããããŸããŸãªæ¹æ³ã§ããŸããŸãªã¢ããªã±ãŒã·ã§ã³éã§ãµãŠã³ãã転éã§ããŸãã ãããããã®aloopããä»®æ³ãã€ã¯ã®ããã«èŠãããã®ãæ§ç¯ããããšã¯ããŸããããŸããã§ããã ãããããããããå¯èœæ§ã¯ãããŸãããç§ã¯ãããã®ALSAæšè£œæ§æãç解ããå¿èãšæéãæã£ãŠããŸããã§ããã
ãããŠãããã¯ãã£ããã«ãŒã¬ããã®ãªãŒãã³ã¹ããŒã¹ã§ã®é³å£°åºåãžã®éãéãã§ãããã 誰ããããã§åºãŠããããHabréã«é¢ããèšäºãæžããŠãã ãããç§ã¯ãã®ããã«ã«ã«ãã䜿ãããšãçŽæããŸã:)
7.ããã§çµããã§ãã
éå±ã§ãéå±ã§ããªãã£ãããšãé¡ã£ãŠããŸãã 楜ããã§ããããŠãã¹ãŠã