ssk’s posterous

ssk’s posterous

Nov 25 / 10:52pm

Video Blogging using Django and Flash(tm) Video (FLV) » DRM - Daniel’s Random Mutterings

by ssk

Adding a video thumbnail

Blog entries in trogger.de can include pictures uploaded by the users. One of these pictures is displayed as a small preview when showing the blog posting (e.g. in the blog overview, or in the list of the latest blog submissions). Wouldn’t it be nice if we could also add a thumbnail for a video submission, so that the blog’s reader can get a first idea of what to expect? I think it would. And, again, ffmpeg comes to the rescue.

ffmpeg can extract single frames from a video stream, storing them in still image format. The command for doing this is:


ffmpeg -y -i [videofile] -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320×240 [thumbnailimage.png]

動画からサムネイル抽出。ffmpeg すごい

Comments (0)

Nov 24 / 10:45pm
by ssk

$ ldd /usr/bin/ffmpeg
        linux-gate.so.1 =>  (0xb7f22000)
        libavformat.so.1d => /usr/lib/libavformat.so.1d (0xb7e93000)
        libavcodec.so.1d => /usr/lib/libavcodec.so.1d (0xb7a36000)
        libavutil.so.1d => /usr/lib/libavutil.so.1d (0xb7a2b000)
        libm.so.6 => /lib/tls/i686/cmov/libm.so.6 (0xb7a06000)
        libpthread.so.0 => /lib/tls/i686/cmov/libpthread.so.0 (0xb79ee000)
        libc.so.6 => /lib/tls/i686/cmov/libc.so.6 (0xb789f000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb788a000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0xb7885000)
        libdc1394_control.so.13 => /usr/lib/libdc1394_control.so.13 (0xb7875000)
        libdl.so.2 => /lib/tls/i686/cmov/libdl.so.2 (0xb7871000)
        libgsm.so.1 => /usr/lib/libgsm.so.1 (0xb7864000)
        libtheora.so.0 => /usr/lib/libtheora.so.0 (0xb781b000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0xb77f3000)
        libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0xb76f7000)
        /lib/ld-linux.so.2 (0xb7f23000)
        libraw1394.so.8 => /usr/lib/libraw1394.so.8 (0xb76f1000)

Ubuntu 8.04 lts の ffmpeg も libx264 へのリンクはない。libx264-57 というパッケージはあるのにね

Filed under  //  ffmpeg   ubuntu  

Comments (0)

Nov 24 / 7:06pm

blog of NiG:Using ffmpeg with libx264 on Ubuntu Jaunty(9.04) - livedoor Blog(ブログ)

by ssk

なんでかなと思ったのだが、強調したlibavcodec.so.52 => /usr/lib/i686/cmov/libavcodec.so.52が問題。
libavcodecっていうのは、ffmpegにおける各コーデックを抽象化(?)しているライブラリらしく、libx264やらlameやらはこいつ経由で呼び出される。
libavcodec自体はffmpegと一緒にコンパイルされて/usr/local/libにインストールされるのだが、/usr/lib/~にlibavcodecがあるとそっちにリンクされてしまう。

邪魔だから消せばいいじゃんと思うところなのだが、/usr/lib/i686/cmov/libavcodec.so.52っていうのは要はlibavcodecというパッケージであり、これにはgstreamer0.10-ffmpegが依存していて、Totem動画プレーヤなんかをまともに使いたかったら入れざるを得ないようになっている。

なんかリンカのオプションでライブラリを探すパスを指定できる。。。らしいんだけど、よく分からなかったので環境変数LD_LIBRARY_PATHを使うことにして、以下のようなラッパスクリプトで回避することにした。

#!/bin/sh
env LD_LIBRARY_PATH=/usr/local/lib ffmpeg "$@"

totem とか使わないのでパッケージの libavcodec は remove した。

Filed under  //  ffmpeg   ubuntu  

Comments (0)

Nov 21 / 12:01am

prefix を外すとどうなるか

by ssk
>> :~/src/thrudb/tutorial/py# python BookmarkExample.py
>> Traceback (most recent call last):
>> File "BookmarkExample.py", line 194, in
>> bm.load_tsv_file("../bookmarks.tsv")
>> File "BookmarkExample.py", line 82, in load_tsv_file
>> self.add_bookmark(b)
>> File "BookmarkExample.py", line 89, in add_bookmark
>> bid = self.store_bookmark(b)
>> File "BookmarkExample.py", line 100, in store_bookmark
>> bid = self.thrudoc.putValue(THRUDOC_BUCKET, b_str)
>> File "../gen-py/Thrudoc/Thrudoc.py", line 242, in putValue
>> return self.recv_putValue()
>> File "../gen-py/Thrudoc/Thrudoc.py", line 266, in recv_putValue
>> raise result.e
>> Thrudoc.ttypes.ThrudocException: ThrudocException(what='S3Backend
error', type=1)

S3Backend error になるのでなんか入れないとだめ

Filed under  //  amazonEC2   amazonS3   python  

Comments (0)

Nov 20 / 11:39pm

Thrudb error message

by ssk

s3 buffer:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>NoSuchKey</Code><Message>The specified key does not exist.</Message><Key>td_bookmarks</Key><RequestId>1FFCA809BE735AF4</RequestId><HostId>+xGw8qmEXQ1Ep2q0jHjFbrXHurwp/YNAN8Yxzfvsmkmy45VirPLSv8tdIdmaEekv</HostId></Error>izati�Traceback (most recent call last):
  File "BookmarkExample.py", line 197, in <module>
    bm.remove_all()
  File "BookmarkExample.py", line 125, in remove_all
    for ids in chunker(seed, 100, self.thrudoc.scan):
  File "BookmarkExample.py", line 28, in chunker
    chunk = func(THRUDOC_BUCKET, seed, size)
  File "../gen-py/Thrudoc/Thrudoc.py", line 277, in scan
    return self.recv_scan()
  File "../gen-py/Thrudoc/Thrudoc.py", line 290, in recv_scan
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
  File "usr/lib/python2.5/site-packages/thrift/protocol/TBinaryProtocol.py", line 126, in readMessageBegin
  File "usr/lib/python2.5/site-packages/thrift/protocol/TBinaryProtocol.py", line 203, in readI32
  File "usr/lib/python2.5/site-packages/thrift/transport/TTransport.py", line 58, in readAll
  File "usr/lib/python2.5/site-packages/thrift/transport/TTransport.py", line 267, in read
  File "usr/lib/python2.5/site-packages/thrift/transport/TTransport.py", line 271, in readFrame
  File "usr/lib/python2.5/site-packages/thrift/transport/TTransport.py", line 58, in readAll
  File "usr/lib/python2.5/site-packages/thrift/transport/TSocket.py", line 94, in read
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

 

エラーが出るが s3 バケットは出来ていた。

Filed under  //  amazonEC2   amazonS3   python  

Comments (0)

Nov 19 / 1:41am

subversion: Subversion 1.6 Release Notes

by ssk

Working Copy Upgrades

WARNING: if a Subversion 1.6 client encounters a pre-1.6 working copy, it will automatically upgrade the working copy format as soon as it touches it, making it unreadable by older Subversion clients. If you are using several versions of Subversion on your machine, be careful about which version you use in which working copy, to avoid accidentally upgrading a working copy. (But note that this "auto upgrade" behavior does not occur with the repositories, only working copies.)

If you accidentally upgrade a 1.5 working copy to 1.6, and wish to downgrade back to 1.5, use the change-svn-wc-format.py script. See this FAQ entry for details, and run the script with the --help option for usage instructions.

Comments (0)

Nov 18 / 9:11pm

悪文:[ECLIPSE][ANT]Unable to find a javac compilerエラーの解決 - livedoor Blog(ブログ)

by ssk
要は、build.xmlのjavacタスクのところに、fork="true"を追加すればよいようだ。

ubuntu 8.04lts では大丈夫だったけど squeeze での make 時にエラーでこけたので。sun-java5-jdk ではなく sun-java6-jdk だったからであろうか

Filed under  //  debian   java   squeeze  

Comments (0)

Nov 14 / 12:30am

Setting up Thrudb with S3 backend or other persistant backend - Thrudb | Google グループ

by ssk
ake Luciani  
プロフィールを表示   日本語に翻訳 翻訳(オリジナルを表示)
 詳細オプション 2008年11月14日, 午前11:04

> Am I missing anything in the config? Both thrudoc/thrudex should be talking
> to s3 right and should every should be persistent right?

No Thrudex is not on s3.  The idea is you rebuild the index based on
the data in thrudoc on restart or recover from a backup.
Also you can use the EBS to create a persistent disk for the index.

thrudex は s3 に置けないから EBS に置け、とのこと

Filed under  //  amazonS3   thrudb  

Comments (0)

Nov 12 / 10:48pm

Come Out With Your Wings Up! — Cute Overload

by ssk

hick-Fil-A robberies across five states.

chicken surprise

I’ll have the “chicken surprise,” Anthea M.

cute

Filed under  //  photo  

Comments (0)

Nov 9 / 8:07pm

PythonでURIエンコードするには - HM python - pythonグループ

by ssk

URIエンコードとデコードにはurllibモジュールのquote()とunquote()が使へる。

# -*- coding: utf-8; -*-

import urllib

print urllib.quote('いろはにほへと')
print urllib.quote(u'いろはにほへと'.encode('euc-jp'))
print urllib.quote(u'いろはにほへと'.encode('shift_jis'))
print urllib.quote(u'いろはにほへと'.encode('iso-2022-jp'))
print urllib.quote(u'いろはにほへと')
print urllib.unquote('%E3%81%84%E3%82%8D%E3%81%AF%E3%81%AB%E3%81%BB%E3%81%B8%E3%81%A8')

實行結果:

%E3%81%84%E3%82%8D%E3%81%AF%E3%81%AB%E3%81%BB%E3%81%B8%E3%81%A8
%A4%A4%A4%ED%A4%CF%A4%CB%A4%DB%A4%D8%A4%C8
%82%A2%82%EB%82%CD%82%C9%82%D9%82%D6%82%C6
%1B%24B%24%24%24m%24O%24K%24%5B%24X%24H%1B%28B
%3044%308D%306F%306B%307B%3078%3068
いろはにほへと

クエリ文字列用のエンコード・デコードにはquote_plus()とunquote_plus()。空白が+に、+が空白になる。

# -*- coding: utf-8; -*-

import urllib

print urllib.quote_plus('Python URIエンコード')
print urllib.unquote_plus('Python+URI%E3%82%A8%E3%83%B3%E3%82%B3%E3%83%BC%E3%83%89')

實行結果:

Python+URI%E3%82%A8%E3%83%B3%E3%82%B3%E3%83%BC%E3%83%89
Python URIエンコード

Filed under  //  python  

Comments (0)