Jump to content

h264 HD Video? Why is it so terrible?


flarefox
 Share

Recommended Posts

MPEG-2 and h264 have been set as the two standards for blue ray and HD-DVD video, so I decided to try my hand at encoding video and playing it back. Just as a dry run, I recorded the season premier of house and season 2 episode 2 of prison break off of an ATSC stream, then cleaned up the mpeg so it wouldn't be quite so hard to encode. After I encoded the video, I find that it only plays at about 25 fps and begins to REALLY lag behind the audio (which I set as ac3 or a/52 in my two test encodes). Noting that the video should have been at 50 fps, what gives? I tried xine and it played.....but like I said, was slow. I tried mplayer (I used mencoder and x264enc to encode it) but mplayer plays 1 frame per second. Imagine my surprise to find that in windows I can run it through vlc and have it work perfectly. The audio is all synced up and everything. It looks gorgeous with the defaults and everything. I love it! So, what gives with the linux decoding? If it can be encoded in linux, it should be able to be played back in the same software it is encoded in, but....it doesn't work. Is there some huge problem there that I'm unaware of or did I pick a codec that I'm not supposed to? I researched it a lot and it seems that I picked the right one. HD video uses h264, the same basic codec as ipod video only with much higher bit rates and a better block setting, so that's what I put in as the setting. The setting is the default middle ground for High Definition video that will start hitting the market by the end of this year. Since linux is supposedly leading the charge in the encoding market I thought it would be the easiest to get working....but...was I wrong or am I missing something? Anyone have an article I can read up on more information about this if I'm missing something?

Link to comment
Share on other sites

I haven't had any problem regarding h264 decoding under linux with mplayer. As for the encoding part I have only encoded to mpeg2 under linux with transcode (for xvid and h264 I use windows because I need to use avisynth).

Maybe the following thread can help you Mencoder parameters for x264 and XviD encoding, if not try to look for other threads under the Linux forum at Doom9.org.

Link to comment
Share on other sites

Thank you! That helped a lot. It still plays back incredibly choppy no matter what I do, but it is less choppy than it used to be. I hope that the h264 codec decodes more smoothly in the future, though. The file sizes are small and nice, but the video is just so choppy!

 

When I run the video in a terminal, I get this with mplayer:

Playing h264ENC_Test.avi.

 

AVI file format detected.

VIDEO: [h264] 1280x720 24bpp 59.940 fps 1935.0 kbps (236.2 kbyte/s)

Clip info:

Software: MEncoder dev-CVS-051220-04:08-4.0.1

==========================================================================

Trying to force audio codec driver family libmad...

Opening audio decoder: [libmad] libmad mpeg audio decoder

AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)

Selected audio codec: [mad] afm: libmad (libMAD MPEG layer 1-2-3)

==========================================================================

Xv: could not grab port 275

==========================================================================

Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family

Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)

==========================================================================

Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...

AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)

Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...

Starting playback...

VDec: vo config request - 1280 x 720 (preferred colorspace: Planar YV12)

VDec: using Planar YV12 as output csp (no 0)

Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.

VO: [xv] 1280x720 => 1280x720 Planar YV12 [zoom]

Error while decoding frame!88 ct: 0.003 3/ 3 ??% ??% ??,?% 2 0 98%

Error while decoding frame!76 ct: 0.005 4/ 4 ??% ??% ??,?% 3 0 97%

Error while decoding frame!78 ct: 0.008 6/ 6 ??% ??% ??,?% 5 0 97%

Error while decoding frame!33 ct: 0.012 8/ 8 ??% ??% ??,?% 7 0 97%

Error while decoding frame!13 ct: 0.013 9/ 9 ??% ??% ??,?% 8 0 97%

Error while decoding frame!08 ct: 0.017 11/ 11 ??% ??% ??,?% 10 0 97%

Error while decoding frame!92 ct: 0.018 12/ 12 ??% ??% ??,?% 11 0 97%

Error while decoding frame!73 ct: 0.022 14/ 14 ??% ??% ??,?% 13 0 97%

Error while decoding frame!57 ct: 0.023 15/ 15 ??% ??% ??,?% 14 0 97%

Error while decoding frame!95 ct: 0.027 17/ 17 ??% ??% ??,?% 16 0 97%

Error while decoding frame!77 ct: 0.030 19/ 19 ??% ??% ??,?% 18 0 97%

Error while decoding frame!61 ct: 0.032 20/ 20 ??% ??% ??,?% 19 0 97%

Error while decoding frame!37 ct: 0.038 24/ 24 ??% ??% ??,?% 22 0 97%

Error while decoding frame!21 ct: 0.040 25/ 25 ??% ??% ??,?% 23 0 97%

Error while decoding frame!56 ct: 0.043 27/ 27 ??% ??% ??,?% 25 0 97%

Error while decoding frame!36 ct: 0.045 28/ 28 ??% ??% ??,?% 26 0 97%

 

Xine actually started playing th video fine when I encode like this:

 

nice -10 mencoder 1161_20060905190000.mpg -ovc x264 -x264encopts pass=1:bitrate=2000:cabac:deblock:frameref=3:bframes=2:b_adapt:qp_step=4:4x4mv:w

eight_b:chroma_me -vf harddup -oac mp3lame -o h264ENC_Test.avi

 

I can't do anything above pass=1 or it won't even start. At least it plays. Thanks for the help! As long as it plays I'm good.

Link to comment
Share on other sites

I would suggest 2 things to improve performance. First, always encode h264 in a mkv or mp4 container as avi can't handle h264 correctly, so maybe that's where your problem lies. And for the second, try to lower the frame rate, use 29.97fps or 23.976fps (in your example go for 29.97 as that's half your current frame rate).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...