Monday, September 26, 2011

Extracting Screen Video with Hsalf

Hsalf repository has a new utility script called svout.py. You can use this script to extract Screen Video frames to separate image files or to dump raw RGB values to stdout.

First, you need to list out all Screen Video streams:

svout.py -i screen.swf
Found Screen Video stream ID 2

Then, extract that stream (2):

svout.py -i screen.swf -s 2 -o output_name

By default, the output format is PNG.

You will have many files whose names are output_name concatenated with number and a proper extesion (.png) such as output_name00001.png.

You can change the output format with -f switch. Use jpg if you want to write JPEG files, or rgb if you want to dump raw RGB data.

svout.py -i screen.swf -s 2 -o output_name -f jpg



If the output file name is a lone hyphen (-), stdout will be used. This is useful if you want to pipe the pictures to video encoders such as FFmpeg or MEncoder.

svout.py -i screen.swf -s 2 -o - -f rgb | ffmpeg -r 24 -s 640x480 -f rawvideo -pix_fmt rgb24 -i - screen.mp4



The above command dumps Screen Video frames to raw RGB data and sends the output through a pipe to FFmpeg to produce a MPEG-4 video file.

No comments:

Post a Comment