I love the x264 codec and I use it to record my games. I'd like to keep using it, but I read on several places people saying it's a "hack" even though it works for me. When I record the videos, I leave the settings like this:
I read that leaving it on "Single pass - lossless" and "Zero Latency" checked, fixes the "hack" problem. But I'd like to know you guys' opinion on it. Are those settings ok? or should I change something?
+ Reply to Thread
Results 1 to 18 of 18
-
-
It is but so is Xvid in an AVI if it uses B-Frames. That's the problem.... the VFW system works on a one frame in, one frame out basis, and I don't think the AVI container has the ability to store information regarding the type of frames. When B-Frames are used the frame display order and the encoding/storage order might be different, so I think for AVC it's the same as Xvid. To get around the problem frames are packed together as a single frame or several frames have to be decoded before any can be displayed, causing a slight delay. The hacks are well supported though, especially for mpeg4 (Xvid, Divx etc). I don't know about AVC as I've not used it in an AVI for anything but an intermediate file for re-encoding on occasion.
The ultra fast preset doesn't use B-Frames so I assume the ultra fast preset on it's own would be enough to avoid any hackery. I'm not sure about the lossless mode. I don't think it uses B-Frames but I'm not certain.
Are you stuck with using the VFW version of x264 for a reason, or forced to use AVI rather than a more modern container such as MP4 or MKV? Playback support for h264 in an AVI is well supported on a PC but it's probably somewhat uncommon for standalone hardware players.Last edited by hello_hello; 8th Nov 2016 at 06:20. Reason: spelling
-
Like hello_hello said, it is kind of a hack but without b frames you are mostly safe.
Your options:
1. switch "Output mode" from "VFW" to "File". This will write to an extra file without AVI but VirtualDub will still create a dummy (or audio-only) AVI file. So you need to mux the video file and the audio-only avi back together later using e.g. mkvmerge.
2. switch to using the https://forum.videohelp.com/threads/367446-Virtualdub-External-Encoder-feature feature of VirtualDub. It supports encoding and muxing without AVI but is more difficult to set up initially. Since you are talking about capturing: I don't know if it possible to use it with VirtualDub capture mode.
3. continue using the hack. If it works for you .. why not?
x264 lossless does indeed not use b frames.Last edited by sneaker; 8th Nov 2016 at 02:51.
-
AFAIK, only MPEG-4 ASP (DivX, Xvid) may use "packed bitstream". AFAIK, there is no "packed bitstream" for H.264 video in an AVI container (probably because nobody wanted to implement the idea
).
H.264 video in AVI is, essentially, the same thing as H.264 video in a transport stream. For the VfW "interface" (so to speak), the problem now is not only the B-frames, but also the multiple reference frames, the B-pyramids, etc. But the ancient and obsolete Video-for-Windows is not the only way to access an AVI file. Windows Media Player itself does not use VfW, except as a "last resort". Both MPC-HC and MPC-BE use DirectShow for dealing with AVI files. Also, keep in mind that the ASF container (pseudo-renamed to "WMV" by Microsoft) is just a glorified AVI, and is as unsuitable as AVI for storing video formats that use B-frames
http://forum.doom9.org/showthread.php?t=120407
http://forum.doom9.org/showthread.php?p=1523574#post1523574Last edited by El Heggunte; 8th Nov 2016 at 05:14. Reason: one more URL :-)
-
The word "hack" does not mean it is bad. The order of frames in AVI must be extracted from avc stream. So what? There is enough software that does it.
The "VirtuaDub hack" option is another story (extension for delayed output from codec) and is not just for VirtualDub, any program may implement it. If it works use it. -
I wasn't sure if "packed bitstream" had ever been implemented for AVC in an AVI. Thanks for the info El Heggunte. It's good to know for certain it hasn't.
-
I'd agree in principle. I have lots of AVIs with Xvid encoded video and packed bitstreams. Hardware player support is so universal it's almost hard to think of it as being a hack any more.... it's just how it works..... but not so much for AVC in an AVI. If you're only ever going to be using a PC for playback it doesn't matter too much, but still.... even if I was writing AVC to an AVI file when encoding I'd probably want to remux it as an MP4 or MKV at some stage so it can be played using a device that isn't a PC.
-
So... from what I gather, if I use x264's lossless mode I will be safe?
-
not necessarily ; it depends on how it's going to be used and what programs
By default, x264's lossless mode --qp 0 (or --crf 0) uses long gop with b-frames to increase compression . So that will lead to the same problems with decoding in susceptible programs ( green frames, black frames, out of order frames, out of sync...) . Some programs will have no problems
Also, many programs cannot decode AVC lossless mode properly
Using all I-frames (instead of long gop) will make out of order decoding less likely in AVI container . But that will significantly reduce compression efficiency .
Some people suggest disabling b-frames, but even p-frames can cause problems in some programs (e.g. vegas) with out of order decoding (mixed up frames). You can find many threads on this on various forums. -
Not quite true. Whatever it's faults, ASF/WMV is a completely reworked container format and uses both extensible GUID headers/metadata and DOES fully support B-frames. It was built with streaming in mind (in answer to RealMedia), which makes use of extended runs of B-frames. Couldn't say whether multi-reference or pyramid features are there, though.
Of course, for best use of AVC & HEVC, I'd suggest using MP4 or MKV containers, both of which have much more thorough & robust support for complex codecs than AVI (as well as better modern player support).
Scott -
-
-
Okay guys, so this is what I did:
1) Capture the game in VFW H264 - Superfast preset (beause Ultrafast fails on certain games) - Keep/Accept only RGB - Single pass lossless - Zero Latency checked.
2) Drag and Drop the .avi into VirtualDub - use the Resize Filter to increase the video's resolution by 8x - Select x264vfw as video compression method (select Convert to YUV 4:2:0 under x264vfw configuration instead of RGB so the video will play everywhere) - Save as AVI.
3) Drag and Drop the new .avi into Avidemux - Select "Copy" as Video Output - Select "AAC (Faac)" as Audio Output - Select "MP4 Muxer" as Output Format - Save the .mp4.
And that's all. Since the final video will be stored into .mp4 instead of .avi, will things be fine then?
P.S. Here is a video showing my whole process step by step: https://www.youtube.com/watch?v=6LI9HmzNBdA -
Yes, remuxing it into a suitable container will fix the problems associated with AVC in AVI, but not all programs or devices accept lossless AVC. So it still depends on how you 're going to be using it
-
Hmmmm, some moons ago, a Doom9 moderator, namely foxyshadis, wrote more or less the same things you said here today. But apparently he forgot to stress that the full features of the ASF container were defined only for the second version of the ASF specification... which almost nobody uses — with Micro$oft themselves not being the exception to the rule.
P.S.:
Originally Posted by benwaggonerLast edited by El Heggunte; 8th Nov 2016 at 18:36. Reason: add P.S.
-
Just to clarify: if a program/device/whatever doesn't support it, the video won't even play at all, right? or will it still play but bugged/glitched or something?
-
Similar Threads
-
Converting h264 to avi
By ziggy1971 in forum Video ConversionReplies: 12Last Post: 22nd Apr 2016, 18:13 -
AVI -> H264 with AAC-LC
By nino_py in forum Video ConversionReplies: 5Last Post: 3rd Aug 2014, 09:19 -
H264 video cutter with smart re-encoding (alternative to VideoRedo H264)
By cheerful in forum Newbie / General discussionsReplies: 1Last Post: 22nd Jul 2014, 08:42 -
Encoding For Better Quality? Codec: H264 - MPEG-4 AVC (part 10) (H264)
By derek123 in forum Video ConversionReplies: 7Last Post: 20th Jan 2014, 04:01 -
H264 to avi?
By dallylama in forum Video ConversionReplies: 43Last Post: 7th May 2012, 06:43