PDA

View Full Version : x264 encoded video is not fluent / stutters


Jan Catrysse
20th August 2008, 18:58
Hi,

We are using x264 to publish our customers video's on their site. In the past we were using FLV (on6).

The image quality is much better but the image is not fluent, it stutters.

This is the commandline used to compress the original hdv5 720p25 file to an m4v container (the encoding bit):
mencoder original.mov -o original_temp.264 -passlogfile original_temp.log -vf scale=640:360,harddup -ovc x264 -x264encopts bitrate=512:frameref=1:bframes=3:b_adapt:b_pyramid:weight_b:8x8dct:subq=1:trellis=2:brdo:threads=1:pass=1:analyse=all -of rawvideo -nosound
mencoder original.mov -o original_temp.264 -passlogfile original_temp.log -vf scale=640:360,harddup -ovc x264 -x264encopts bitrate=512:frameref=8:bframes=3:b_adapt:b_pyramid:weight_b:partitions=all:8x8dct:me=umh:subq=6:trellis=2:brdo:threads=1:pass=2:analyse=all -of rawvideo -nosound

Can this be fixed?

Regards,
Jan

Dark Shikari
20th August 2008, 19:07
1. There is no such thing as an "m4v container."

2. .h264 is an elementary stream--no container at all.

3. Are you sure your computer used for playback isn't too slow?

Jan Catrysse
20th August 2008, 21:53
Hi, thanks for your reply.

I am confused. I am fully aware that the x264 part is't the container but I am (was) pretty sure that .m4v is a container format (should be extension .mp4 to be fully compliant i assume)...

The mencoder part is converting, resizing the original .mov file (hdv5 720p25) to raw 264 data. The audio extraction, coding and the muxing is done afterwards (neroenc and mp4box)

You can find the .flv and the .m4v on the following URL:
test.m4v (http://video.proximedia.com/videoentreprise/bezoom/70007777/test.m4v)
test.flv (http://video.proximedia.com/videoentreprise/bezoom/70007777/test.flv)

I have tried different machines from a simple centrino laptop to quad core workstations, the problem is more apparant on a very slow machine but never gone.
The files are for internet playback, so they are quitte small...

All help is welcome

Selur
20th August 2008, 22:06
my first guess would be that mencoder isn't so good at handling mov files,..

kemuri-_9
20th August 2008, 22:07
.m4v is not a container, it is actually is a raw stream of MPEG-4 video data.
it is similar to the .m2v extension, which implies a raw stream of MPEG-2 video data.
so technically .h264 is a .m4v, but .h264 is more specific in specifying that it is an h264 (MPEG-4 Part 10) raw stream rather than just a general MPEG-4 raw stream.
.mp4 is a valid container and you can take .h264 and .m4v streams and place them into .mp4 using mp4box specifying their framerates as raw streams are generally muxed/interpreted at a framerate of 25fps.

Jan Catrysse
20th August 2008, 22:27
Learning new stuff every day ;)

I suppose I haven't got a better (Freebsd/linux) alternative to mencoder? I just start to understand it a little bit.

I have to say that:
I am using the latest version of mencoder (MPlayer-1.0rc2) from the FreeBSD ports tree, same for the x.264 library (2008-04-09 snapshot).
I tried compiling the new versions from CVS a few times but I am allways running into stop errors (FreeBSD 7.0-STABLE AMD64)

Could that make a major difference?

When you check the test files, are you allso seeing the problem?

CruNcher
20th August 2008, 22:49
Hi, thanks for your reply.

I am confused. I am fully aware that the x264 part is't the container but I am (was) pretty sure that .m4v is a container format (should be extension .mp4 to be fully compliant i assume)...

The mencoder part is converting, resizing the original .mov file (hdv5 720p25) to raw 264 data. The audio extraction, coding and the muxing is done afterwards (neroenc and mp4box)

You can find the .flv and the .m4v on the following URL:
test.m4v (http://video.proximedia.com/videoentreprise/bezoom/70007777/test.m4v)
test.flv (http://video.proximedia.com/videoentreprise/bezoom/70007777/test.flv)

I have tried different machines from a simple centrino laptop to quad core workstations, the problem is more apparant on a very slow machine but never gone.
The files are for internet playback, so they are quitte small...

All help is welcome

Does Nero now allows the commercial usage of neroenc ?
you should better read their license agreement or you could get your company into trouble


Nero AG licenses you to use this software package for personal non-commercial and/or technology-evaluation purposes.

A written license agreement with Nero AG is needed for any Commercial use of this software package, including, but not limited to, exploitation of products, which are incorporating and/or using, in whole or in part, executables provided in this software package

Please contact Nero AG for licensing guidance.

Or does it have to explicitly state (for any Commercial use of this software and the use of files/bitstreams created with it) ?

nm
20th August 2008, 23:51
I have to say that:
I am using the latest version of mencoder (MPlayer-1.0rc2) from the FreeBSD ports tree, same for the x.264 library (2008-04-09 snapshot).
I tried compiling the new versions from CVS a few times but I am allways running into stop errors (FreeBSD 7.0-STABLE AMD64)

Could that make a major difference?
Probably not, but using the latest SVN revision is advised when there are unexpected problems with earlier versions.

When you check the test files, are you allso seeing the problem?
Yes. There are duplicate frames in the H.264 encode. Have you tried encoding without the harddup filter? How did you encode the FLV/VP6 version?

Jan Catrysse
21st August 2008, 10:30
Does Nero now allows the commercial usage of neroenc ?
Probably not, I didn't really payed any attention. We are just testing the new encoding for the moment... We'll use something else ;)

Have you tried encoding without the harddup filter?
See: test2.m4v (http://video.proximedia.com/videoentreprise/bezoom/70007777/test2.m4v)
I think it's a lot better, but the audio is completely out of sync now. I remember adding the harddup just because I had A/V sync problems...
This is another example:
w/ harddup: test4.m4v (http://video.proximedia.com/videoentreprise/bezoom/70007777/test4.m4v)
w/o harddup: test3.m4v (http://video.proximedia.com/videoentreprise/bezoom/70007777/test3.m4v)

The FLV's are made by my collegues on a Mac, I don't really know the encoder they use. It isn't a commandline tool.

nm
21st August 2008, 11:35
I think it's a lot better, but the audio is completely out of sync now. I remember adding the harddup just because I had A/V sync problems...
Now there were skips instead of duplicates, which leads to video playing faster than audio.

How about trying with "-noskip -mc 0"? That should disable all frame dropping and duplicating in MEncoder. If the video still skips, next step is to build the latest SVN revision. Or I could try it if you can upload a piece of the source video.

Jan Catrysse
21st August 2008, 15:11
Now there were skips instead of duplicates, which leads to video playing faster than audio.
How about trying with "-noskip -mc 0"? That should disable all frame dropping and duplicating in MEncoder.

That doesn't seem to change a thing.
I am not sure the -mc 0 option is very useful. I am first encoding the video into a raw x264 and afterwards I extract the sound using:
mplayer "filename.mov" -af resample=48000:0:2,volnorm=2:0.25 -ao pcm:file="filename_temp.wav" -vc null -vo null
Doing so I can compress the sound and mux it all together the way I like.

I'm trying to compile and install the latest from cvs, I hope I'll get it working :(

This is the example:
test5.m4v (http://http://video.proximedia.com/videoentreprise/bezoom/70007777/test5.m4v)

Jan Catrysse
21st August 2008, 17:51
Well... no luck compiling from latest sources...
x264 worked but ffmpeg and mplayer didn't :(

I did some further testing.
The original MOV files playes like a charm on Mac + Quicktime. When I play it however on VLC media player I have the same problem. The problem it seems is not in the encoding stage but on the reading stage.

Those is the warnings output from VLC:
main error: decoder is leaking pictures, resetting the heap
main error: picture 00CB1A10 refcount is -1
main error: picture to date 00CB1D40 has invalid status 6
main error: picture to display 00CB1D40 has invalid status 6
main error: picture 00CB1D40 refcount is -1
main error: decoder is leaking pictures, resetting the heap
main error: picture to date 00CB1C30 has invalid status 6
main error: picture to display 00CB1C30 has invalid status 6
main error: picture 00CB1C30 refcount is -1
main warning: backward_pts != dts (40000)
main error: decoder is leaking pictures, resetting the heap
main warning: backward_pts != dts (40000)
main error: picture 00D04FC8 refcount is -1
main error: picture to date 00D052F8 has invalid status 6
main error: picture to display 00D052F8 has invalid status 6
main warning: backward_pts != dts (40000)
main error: picture 00D052F8 refcount is -1
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
libmpeg2 debug: 1280x720 (display 1280,720), aspect 768000, sar 1:1, 25.000 fps
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
libmpeg2 debug: 1280x720 (display 1280,720), aspect 768000, sar 1:1, 50.000 fps
main warning: dts != current_pts (-16625)
main warning: backward_pts != dts (40000)
main error: decoder is leaking pictures, resetting the heap
main error: picture to date 00D052F8 has invalid status 6
main error: picture to display 00D052F8 has invalid status 6
main warning: backward_pts != dts (40000)
main error: picture 00D052F8 refcount is -1
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)
main warning: backward_pts != dts (40000)

Comatose
23rd August 2008, 20:42
.m4v is not a container, it is actually is a raw stream of MPEG-4 video data.
it is similar to the .m2v extension, which implies a raw stream of MPEG-2 video data.
so technically .h264 is a .m4v, but .h264 is more specific in specifying that it is an h264 (MPEG-4 Part 10) raw stream rather than just a general MPEG-4 raw stream.
.mp4 is a valid container and you can take .h264 and .m4v streams and place them into .mp4 using mp4box specifying their framerates as raw streams are generally muxed/interpreted at a framerate of 25fps.
Well, yes, it's supposed to be a raw stream, but most m4v files are actually renamed mp4 files (blame Apple)...

OP: Since you say the problem is in the reading part, try looking into using Avisynth as your x264 input, and use one of the Quicktime source filters like QtInput.