Log in

View Full Version : Video ahead of sound (and subtitles)


drakend
26th October 2005, 15:52
Hello to all,
this is my first post here, I hope to not get too flamed :)
I've encoded a Matroska file with this structure:
video coded with x264 latest build
audio coded with ogg vorbis
ssa subtitles
I decode this with ffdshow latest build

I have the problem that the video is way ahead of sound and subtitles... while this doesn't happen if I use xvid to encode the video.
I have an Athlon XP 3000 (not 64 bit) with 512 Mb of RAM PC3200, I shouldn't have any problems in decoding with my hardware, right?

Another thing: If I enable the postprocessing filter while watching the matroska with xvid video the cpu use doubles... is it normal?!?

bond
26th October 2005, 21:23
welcome to doom9 :)

you either set the wrong or no delay altough needed when encoding the audio

drakend
26th October 2005, 21:41
welcome to doom9 :)

you either set the wrong or no delay altough needed when encoding the audio
How can I calculate that value? I had no clue of this requirment... :)

bond
26th October 2005, 21:44
when ripping the audio from the dvd/vob the delay is normally written in the filename

drakend
26th October 2005, 21:46
when ripping the audio from the dvd/vob the delay is normally written in the filename
no I'm compressing it from an xvid source... yes I know it's a dirty work, but I think x264 rocks :)

hpn
26th October 2005, 23:45
If you just want to achieve better quality by recompressing from XviD to x264 you're wasting time, simply because you can't get a better looking video from a low quality source by recompressing it with a superior codec (not that XviD is low quality). Such XviD to x264 transcoding makes sense only if you for some reason want to have a significantly smaller copy of the XviD file (for example 700kb to 200kb), otherwise just keep your XviD file as it is.

drakend
27th October 2005, 07:56
If you just want to achieve better quality by recompressing from XviD to x264 you're wasting time, simply because you can't get a better looking video from a low quality source by recompressing it with a superior codec (not that XviD is low quality). Such XviD to x264 transcoding makes sense only if you for some reason want to have a significantly smaller copy of the XviD file (for example 700kb to 200kb), otherwise just keep your XviD file as it is.
Yes of course I know this... you cannot create nothing from nothing, this principle applies to digital movies too. :)
In fact I wanted to reduce the file size and I reduced it by about 30%: the problem isn't within the video coded, but with the file matroska. The audio is behind the video by about 1 minute or more and setting the audio delay, as suggested by bond in mkvtoolnix, doesn't change anything.

ChronoCross
27th October 2005, 08:02
try using the mp3 audio from the avi. mux it with the x264 encoded file into mkv. Perhaps it's something in your ogg settings. as for the subs. Best I can think of at the moment is that the timestamps are off. If indeed your PC doesn't max out trying to decode the video there is no reason that it should be off by that much if your only changing the video.

Edit: I'm assuming that your source is an xvid avi. was it an mkv to start off? If so then it could be a problem with the video being variable framerate. that will throw the audio and video off bigtime if you don't mux the vfr-timecodes fiel into your new mkv.

drakend
27th October 2005, 09:04
try using the mp3 audio from the avi. mux it with the x264 encoded file into mkv. Perhaps it's something in your ogg settings. as for the subs. Best I can think of at the moment is that the timestamps are off. If indeed your PC doesn't max out trying to decode the video there is no reason that it should be off by that much if your only changing the video.

Edit: I'm assuming that your source is an xvid avi. was it an mkv to start off? If so then it could be a problem with the video being variable framerate. that will throw the audio and video off bigtime if you don't mux the vfr-timecodes fiel into your new mkv.
Hello, thanks for the extensive reply. I started from an ordinary avi with xvid video and mp3 audio. I used virtual dub to encode the video track in x264 to a new avi file and cdex to encode the audio track (I extracted before from the original avi) in ogg format. Then I used avi2raw to extract the raw h264 video from the file created by virtualdub and I put it into an mp4 file with yamb. After this I mixed the mp4 file, the ogg vorbis file and the ssa subtitles together. The result is a video far ahead the audio and subtitles.
I tried to put the the mp3 audio file and the h264 one into the mkv container, but it doesn't change anything. If I use xvid format instead into the mkv container all works fine.
I tried with a totally different movie coded from avi (h264+mp3) into mkv... there is the exact same problem... I used all the latest versions of the software I used of course.
This last case shows clearly that shouldn't be a cpu power problem: the codecs used in avi and mkv is the same, so why in avi there isn't any problems and in mkv yes?

Daodan
27th October 2005, 09:10
Well, it's only a suggestion but you could try using something else instead of Vdubmod, like MeGui for example (you'll need a avisynth script but there are programs to help you with that). It seems Vdubmod doesn't handle x264 too well, I had some problems with it myself.

foxyshadis
27th October 2005, 09:58
Then I used avi2raw to extract the raw h264 video from the file created by virtualdub and I put it into an mp4 file with yamb.

I suspected something like this. You MUST specify the framerate when muxing raw h.264 into mp4, mp4box simply doesn't read it. Either use the newest YAMB or enter it on the command line (--fps 29.97 etc.) yourself. It will always default to 25 otherwise.

drakend
27th October 2005, 10:55
(for example 700kb to 200kb), otherwise just keep your XviD file as it is.
Can x264 really work so well? I thought I can reduce the file size of about 30%, not of 60%...
Anyway now it seems to work with media player classic, it was really the frame rate thing :)

foxyshadis
27th October 2005, 12:17
For most sources, it seems you can squeeze 30% extra out without it looking much worse, but you can also filter agressively and crank the inloop up, and it will often look a lot more acceptible than xvid and others. =p

drakend
27th October 2005, 13:31
For most sources, it seems you can squeeze 30% extra out without it looking much worse, but you can also filter agressively and crank the inloop up, and it will often look a lot more acceptible than xvid and others. =p
Which filter should I use? Can you give me the link to some tutorials about this? :)

ChronoCross
27th October 2005, 15:04
First you should solve the framerate issue. try foxyshadis's suggestion of

Then I used avi2raw to extract the raw h264 video from the file created by virtualdub and I put it into an mp4 file with yamb.

I suspected something like this. You MUST specify the framerate when muxing raw h.264 into mp4, mp4box simply doesn't read it. Either use the newest YAMB or enter it on the command line (--fps 29.97 etc.) yourself. It will always default to 25 otherwise.

See it always helps to give more information about your problem. by explaining it more thuroughly you opened up lots more doors for solving the problem.

hpn
27th October 2005, 15:27
Can x264 really work so well? I thought I can reduce the file size of about 30%, not of 60%...
No. I meant if you wanted to recompress some unimportant content regardless of the quality. That's why I said 200kb, instead of 500k or something ;)

drakend
27th October 2005, 17:26
First you should solve the framerate issue. try foxyshadis's suggestion of



See it always helps to give more information about your problem. by explaining it more thuroughly you opened up lots more doors for solving the problem.
I've solved that problem, it was the framerate thing... such an idiot cause... :D
Anyway I've had to upgrade to the latest ffdshow because media player classic kept crashing with the previous ones... the only thing is that if I use image properties (to increase brightness) and postprocessing the cpu usage go up to 50%-60%...

stephanV
27th October 2005, 17:53
the only thing is that if I use image properties (to increase brightness) and postprocessing the cpu usage go up to 50%-60%...
Thats normal.

drakend
27th October 2005, 21:42
Thats normal.
Can a possible solution be doing the filtering thing during encoding?

nm
27th October 2005, 22:12
Why do you need to increase brightness and do postprocessing? Brightness and contrast can usually be changed in the display device or by changing hardware overlay settings. And for postprocessing, there are not many filters that are suitable for use with AVC-encoded video.

Edit: Noticed that you were referring to XviD. Re-encoding with filtering will drop the quality significantly, so I don't really see the benefits.