Sunday, March 7, 2010

ffmpeg x264 stop working again

After I upgraded to fedora 12, it gaves me:
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height
when I run my MOV-to-PS3-compatible-MP4 script. I have been scratching my head wondering why. After a few hours of testing and goolging, I fount out ffmpeg needs these options in order to consider "correct":
-g 250 -qcomp 1.0 -qmin 10 -qmax 51 -qdiff 4
But that is not the end of the story. Although ffmpeg was willing to run, the resulting MP4 files cannot be played by the PS3. It said "unsupported format". It gave me another few hours of head scratching (because googling doesn't work this time). The answer this time was dimension, I didn't know when did the 5Dmk2 start making movies with 1920x1088 pixels. The PS3 can only play 1920x1080. The extra vertical 8 pixels was the real cause of my trouble.

The updated command line is like this:
ffmpeg -i INPUT -vcodec libx264 -vpre hq -level 41 \
-maxrate 62500k -bufsize 78125k -b 30M -s hd1080 -y \
-f mp4 -acodec libfaac OUTPUT


The hq preset was used to replace the clumsy x264 settings like flags and others. The maxrate, bufsize and b (bitrate) options were tailored to the PS3. -s hd1080 fixed the size to 1920x1080. -f mp4 specified the MP4 container. -acoded libfaac specified using AAC for audio encoding.

Sunday, September 20, 2009

Creating DivX AVI for PS3 using ffmpeg

The working command line is:
ffmpeg -i MVI_????.MOV -vcodec mpeg4 -qscale 4 -acodec mp2
-f avi -threads 2 -vtag DX50 -ab 128k output.avi
Note that we need to use DX50 as fourCC or else PS3 will not like it. Also, if the audio bitrate (specified by -ab) is 64k (which is the default), PS3 will play some noise instead. I am not sure if it is a ffmpeg or PS3 problem.

Saturday, September 12, 2009

New ffmpeg Flags

Last time, I post a ffmpeg command line to transcode video for the PS3. I just found out that it doesn't work anymore:
Unable to parse option value "trell+aic": undefined constant or missing (
Invalid value '+4mv+trell+aic' for option 'flags'
This post shown that we need
to remove +trell and add back -trellis 1 to the command line and it will work. Therefore the new magic ffmpeg command line for PS3 is:
ffmpeg -i MVI_????.MOV -vcodec libx264 -level 41 -maxrate 62500k
-bufsize 78125k -b 10000k -acodec libfaac -f mp4 -mbd rd -flags 4mv+aic+qprd+mv0
-trellis 1 -cmp 2 -subcmp 2 -flags2 dct8x8+skiprd -threads 2 output.mp4

Sunday, July 26, 2009

Security Warnings on Shared Directories?


This is what I get when I right click a file in a shared folder in windows XP. It seems pretty serious. I think many people have seen it before when using shared folders.

Exactly what happened? I just right-clicked a file without opening it. Is it possible to compromise the security of my machine by just right-clicking a file?

The answer lies in what windows does when you right click a file. Actually windows does quite many things in the background. Have you notice that you get a different menu when you right click different file types? Does windows determine file types by merely looking at its file extensions? What about preview? If any of these operations has a security hole, right clicking a malicious file can compromise security.

I don't know the exact details of right clicking, but I bet microsoft had a security vulnerability on the right click-code in explorer before. That is why they put up a such warning message to shift the responsibility to the user. Let's say in the future if there is another new hole in the right-click again, they can claim that the wide spread of the exploit is due to "social engineering" but not technical measure. In other words, the users are to stupid to listen to other people (i.e. affected by others socially) to click the yes button in the warning message.

I believe real security is to design the software such that right-clicking a file will not do anything specific to the content of that file. Anything other than this is just a work-around to the problem. Until microsoft realize this, we will still see many security fixes every month from microsoft.

Wednesday, July 15, 2009

Invulnerable Linker Warnings

Recently I got many LNK 4099 warnings like:
warning LNK4099: PDB 'vc90.pdb' was not found with foobar.lib';
linking object as if no debug info
Which I cannot disable.

This is stupid.

This is absolutely no big deal that a tiny little particular object or library does not have debug info. OK I know, thanks for telling me. Can you please STFU?

No, it can't.

http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=162246
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=176188

How pathetic.

Wednesday, May 6, 2009

Lego Castle!


新玩具!

小時候一向喜歡Lego的城堡系列。這款新的城堡Lego和其他不同。這是一條小村莊,基本上除了打鐵匠之外很少武器。日常用品反而很多。例如食物,金幣,小刀,梳子等等。十分有趣。

Tuesday, April 28, 2009

Converting Canon 5D Mark II Video for PS3

The story has not yet ended.

I found out that the following ffmpeg recipe works even for 1080p video from 5Dmk2:

ffmpeg -i MVI_????.MOV -vcodec libx264 -level 41 -maxrate 62500 -bufsize 78125 -b 6000k -acodec libfaac -f mp4 -mbd rd -flags 4mv+trell+aic+qprd+mv0 -cmp 2 -subcmp 2 -flags2 dct8x8+skiprd -threads 2 output.mp4

The trick is to use -maxrate and -bufsize to control the quality such that the PS3 likes it. The PS3 supports level 4.1 high profile AVC encoding, which can store at most 62.5M bits per second. That is why we put the -maxrate 62500 there.