View Full Version : tool to extract H.264 frame size vector


whiteg
25th August 2009, 17:49
When running x264, it can produce a debug output that gives information on the size of each compressed frame (in bytes) like so:

x264 [debug]: frame= 0 QP=13.21 NAL=3 Slice:I Poc:0 I:1200 P:0 SKIP:0 size=141645 bytes PSNR Y:47.71 U:51.15 V:51.17 SSIM Y:0.99635
x264 [debug]: frame= 1 QP=12.84 NAL=2 Slice:P Poc:2 I:0 P:465 SKIP:735 size=1151 bytes PSNR Y:47.78 U:51.16 V:51.18 SSIM Y:0.99637
x264 [debug]: frame= 2 QP=12.86 NAL=2 Slice:P Poc:4 I:0 P:415 SKIP:785 size=668 bytes PSNR Y:47.78 U:51.17 V:51.18 SSIM Y:0.99637
x264 [debug]: frame= 3 QP=12.86 NAL=2 Slice:P Poc:6 I:0 P:410 SKIP:790 size=639 bytes PSNR Y:47.78 U:51.17 V:51.18 SSIM Y:0.99637

Is there a tool (ideally free) that can take an already compressed file (.mov, .mp4, whatever) and produce a similar output for the video track? Obviously it wouldn't be able to provide PSNR data, but I'm mainly interested in the frame/slice type and size in bytes.

Thanks.
Greg

Dust Signs
26th August 2009, 06:35
There used to be a free version of H264Visa (http://www.h264visa.com/downloads.html) which I used for analyzing H.264 streams when writing my diploma thesis. Its output is however very detailed, so the information you are looking for should be displayed as well.

Dust Signs

NaturalThoughts
26th August 2009, 13:10
Yea H.264Visa is a good tool and it supports baseline and main profile of H264. But one think I doubt that it'll take .mp4 or .mov......
You should used .264 file.

LoRd_MuldeR
26th August 2009, 13:39
But one think I doubt that it'll take .mp4 or .mov......

It does, but a .264 file be extracted ;)

http://img213.imageshack.us/img213/7061/h264visamp4.th.png (http://img213.imageshack.us/img213/7061/h264visamp4.png)

There used to be a free version of H264Visa

There's a 30 day trial period even in the latest version. And you can have as many trial periods as you like :)

Dust Signs
26th August 2009, 13:39
Yea H.264Visa is a good tool and it supports baseline and main profile of H264. But one think I doubt that it'll take .mp4 or .mov......
You should used .264 file.

Why not take a look at the feature list first?

File formats:
+ H.264 Byte Stream format(Annex B)
+ H.264 in RTP format
+ flash flv/f4v file formats
+ MP4/3GP/M4V file formats.
+ mpeg2 ts file format, including mpeg2 ts for ISDB-T 1seg

Dust Signs

NaturalThoughts
26th August 2009, 13:50
ohhh thanks for the link...
I guess it's time to upgrade my current old visa 1.07 with the latest Ver 1.16.

Dust Signs
26th August 2009, 13:54
ohhh thanks for the link...
I guess it's time to upgrade my current old visa 1.07 with the latest Ver 1.16.
Just be careful as none of the new versions is free any more.

Dust Signs

LoRd_MuldeR
26th August 2009, 14:02
Just be careful as none of the new versions is free any more.

It is! I'm using v1.16 and apparently it has a free 30 day trial period :confused:

Dust Signs
26th August 2009, 14:18
Back in the days when H264Visa was free I saved the setup of the version I downloaded as I always wondered how long it would be available for free as it provides lots of features many developers would we be willing to pay a lot of money for. //EDIT: Version 1.00 can be found here: http://h264visa.googlepages.com/H264Visa.zip
Dust Signs

LoRd_MuldeR
26th August 2009, 14:22
Back in the days when H264Visa was free I saved the setup of the version I downloaded as I always wondered how long it would be available for free as it provides lots of features many developers would we be willing to pay a lot of money for. Although I'm not sure if I'm allowed to post one of the old setups here you can send me a PM or mail and I'll send it to you.

Dust Signs

What is the problem with the current Setup? You click "Register Later" at application startup and that's it.

After 30 days you re-install and the trial period starts again. Until that is changed, there is no real limitation in the unregistered version...

(And if you use it all the time, so that the popup becomes nasty, you should consider buying the full version anyway)

Dust Signs
26th August 2009, 14:30
:p I didn't even try to reinstall the new setup after 30 days as I expected it would not be possible like with many other software products out there for trial. Sorry :p

Dust Signs

whiteg
26th August 2009, 19:07
Thanks for the suggestion. I'll give it a spin for 30-days (not sure I'm comfortable going beyond that). $450 USD seems pretty steep though just to parse the file and spit out frame sizes and types. This tool definitely provides a lot more analysis than I'll ever use.

I found that the command line version of ffmpeg will dump the information that I'm looking for (using the -vstats option). But, I can only get it to do so when it is actually transcoding the content. When I set "-vcodec copy" (to disable transcoding) it does not produce the frame statistics output. Maybe I'm missing a setting somewhere (there are a lot of settings)?

poisondeathray
26th August 2009, 19:16
If you need a free method, you can parse using ffdshow's osd . Just make sure your directshow chain is set to ffdshow for decoding your particular video

You can set it to read frame type, and codec picture size in the options

If you enable "save to", it will record a spreadsheet with each parameter chosen for each frame

Dark Shikari
26th August 2009, 19:21
mkvinfo can output frame sizes iirc.

whiteg
26th August 2009, 22:57
Thanks all!

The combination of ffmpeg (to convert to .mkv) and mkvinfo did the trick (at least for framesize, mkv info doesn't output slice type, but that is less of a concern), and fit into my workflow better than the other options suggested.

For future viewers of this thread, here is the script I wrote to extract video frame size into a *.m file that can be read into Matlab.

#!/bin/tcsh

echo "FS=[" >$1.m
ffmpeg -i $1 -vcodec copy -an -f matroska -y $1.mkv
mkvinfo -v $1.mkv | awk '/Frame/ { print $6 }' >>$1.m
rm -f $1.mkv
echo "];" >>$1.m