Log in

View Full Version : Avidemux - pack bitstream in a h264 mp4 file


STFU
28th September 2010, 19:54
What I want is when I move to the next keyframe to actually be on the next keyframe.

When you have an avi(xvid) file with BVOPs and you try to edit this in virtualdub when you go to the next keyframe you're one frame behind, now when you pack the bitstream of that file with MPEG4Modifier you do get accurate frame movement.

Now in Avidemux it seems to be exactly the opposite when there is a packed bitstream you get the lag.

Now I wonder how to solve this with mp4(h264) files.
I have both files that are accurate when moving to the next keyframe and files that are not.
The main difference seems to be that there is no CABAC in the one that is accurate, however when I convert an avi(xvid), both with packed bitstream and without, file to a mp4(h264) file with no CABAC, I still don't get accurate movement.

What is the cause of this in mp4(h264) files, and is there a simple way to solve this, either modifying the mp4 itself or using avidemux.

Rebuilding frames in avidemux doesn't help.

NOT accurate
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 35s 360ms
Bit rate mode : Variable
Bit rate : 1 273 Kbps
Width : 640 pixels
Height : 352 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.226
Stream size : 5.37 MiB (92%)

accurate
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Baseline@L3.0
Format settings, CABAC : No
Format settings, ReFrames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 26s
Bit rate mode : Variable
Bit rate : 1 479 Kbps
Width : 640 pixels
Height : 272 pixels
Display aspect ratio : 2.35:1
Frame rate mode : Constant
Frame rate : 23.947 fps
Original frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.355
Stream size : 15.3 MiB (90%)
Color primaries : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M
Thnx in advance.

LoRd_MuldeR
28th September 2010, 20:01
When Avidemux detects an AVI file with "packet bistream" hack, it will suggest to unpack. You should follow this advice and continue your work with the unpacked (proper) file.

Anyway, I'm not aware for an equivalent of the "packet bistream" hack for H.264 streams. However Avidemux 2.5.x has known problems with frame-accurate access with H.264 streams that use B-Frames.

This will be much better in Avidemux 2.6, which you can find here (http://www.avidemux.org/nightly/) (experimental!). Until then, I would highly recommend to use the Avisynth Proxy (http://avidemux.org/admForum/viewtopic.php?id=4397) to load H.264 video files into Avidemux.

STFU
28th September 2010, 20:16
When Avidemux detects an AVI file with "packet bistream" hack, it will suggest to unpack. You should follow this advice and continue your work with the unpacked (proper) file.


noticed that but i was just giving an example so....

anyway, I figured that this problem could be in avidemux but how about the files that it does process accurately, something in those files ought to be different right?

LoRd_MuldeR
28th September 2010, 20:21
anyway, I figured that this problem could be in avidemux but how about the files that it does process accurately, something in those files ought to be different right?

I guess those either aren't H.264 and/or they don't use B-Frames. Follow my suggestion an use the AVS Proxy for the "problematic" files (or try Avidemux 2.6).

EDIT: Just noticed your edit. Indeed the "accurate" file doesn't use B-Frame, which is indicated by "Baseline" profile. So my guess was correct.

STFU
28th September 2010, 20:40
I guess those either aren't H.264 and/or they don't use B-Frames. Follow my suggestion an use the AVS Proxy for the "problematic" files (or try Avidemux 2.6).

EDIT: Just noticed your edit. Indeed the "accurate" file doesn't use B-Frame, which is indicated by "Baseline" profile. So my guess was correct.

never knew that baseline ment no b frames, thought it was simply a restiction thing like Advanced Simple@L5 is in xvid encoding, well that explains at least why those file are accurate.

I looke at the nightly build and it does indeed process the b-frame mp4 files acuurate.

I have no experience with Avisynth so I''ll have to take a look at how to work with that for the time being, but hope that'll work out, thanks again for the help.:)

LoRd_MuldeR
28th September 2010, 20:55
never knew that baseline ment no b frames, thought it was simply a restiction thing like Advanced Simple@L5 is in xvid encoding, well that explains at least why those file are accurate.

http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Profiles ;)

I looke at the nightly build and it does indeed process the b-frame mp4 files acuurate.

Nice :)

I have no experience with Avisynth so I''ll have to take a look at how to work with that for the time being, but hope that'll work out, thanks again for the help.:)

That's why I put the AVS Proxy GUI (http://avidemux.org/admForum/viewtopic.php?id=4397) together, so even people who aren't experienced with Avisynth can use the AVS Proxy...

STFU
29th September 2010, 21:10
[url]
That's why I put the AVS Proxy GUI (http://avidemux.org/admForum/viewtopic.php?id=4397) together, so even people who aren't experienced with Avisynth can use the AVS Proxy...


I gave it a shot but I can't seem to get AVS proxy to work. keep getting stuck at this when pressing create proxy

AvsSocket Proxy, derivated from avs2yuv by Loren Merritt Loading Avisynth.dll
Avisynth.dll loaded
Env created
after killing the process
> Exit Code: 1

I don't really know but have a feeling that this could be a plugin problem??
I installed Avisynth 2.58, which doesn't create a plugin folder but after reading what it should be I create a map C:\Program Files\AviSynth 2.5\Plugins and put these files in there:
NicAudio.dll
avss.dll
ffms2.dll

I use Avidemux 2.52 unpacked from a zip file, so not installed,this is what the files in the temp folder said:

FFVideoSource("E:\Programs\uTorrent\SPORT\Motor sport\2009\MotoGP.2009.Round06.Spain.Catalunya.Race.Eurosport.mp4", cachefile="C:\DOCUME~1\Eigenaar\LOCALS~1\Temp\b86982b7b0e183bd7de78d201aee1aab.ffindex", track=1, colorspace = "YV12")

AVISource("E:\Douments & Settings\Mijn documenten\Mijn videos\Spot to watch Now\the.daily.show.avi", audio=false)
ConvertToYV12()

When using 2.53 I have the same problem, and get the same messages in those temp folder files.

Also tried DirectShowSource2 same result, and I do have the necessary dshow filters installed.

Am I missing something here??


EDIT

searched google, but not the forum here for:
AvsSocket Proxy, derivated from avs2yuv by Loren Merritt Loading Avisynth.dll
Avisynth.dll loaded
Env created
http://forum.doom9.org/showthread.php?t=136670&highlight=AvsSocket+Proxy%2C+derivated+avs2yuv+Loren+Merritt+Loading+Avisynth.dll+loaded+Env+created

Avisynth doesn't work properly when the extras are also installed, reinstalled without, plugin folder now is present, and it works.

However when loading in a mp4 file now the keyframes are gone, is this normal cause I like to use Direct stram copy so they are essential for editing.

LoRd_MuldeR
29th September 2010, 21:29
First of all you should get the latest Avidemux 2.5, which is r6636 currently, from here:
http://avidemux.razorbyte.com.au/

I recommend to use the installer. If you use the installer, make sure to choose installing the "AVS Proxy GUI" during setup!

Also I would recommend to get the latest FFmpegSource2 (FFMS2.dll) from here:
http://forum.doom9.org/showpost.php?p=1446216&postcount=918

Furthermore you didn't say in which way you got stuck. When you tried to open the AVI via FFVideoSource() in AVS Proxy GUI, what did happen?
Did you wait a while until FFmpegSource2 finished indexing the source file? It may take a few moments...

Anyway, create a text file (e.g. with Notepad) enter the following text and then save it as "Something.avs":
FFVideoSource("C:\Path to your file\Something.mp4")

Try to open that AVS file with VirtualDub, let it do its job (i.e. wait!) and then report back...

LoRd_MuldeR
29th September 2010, 21:43
However when loading in a mp4 file now the keyframes are gone, is this normal cause I like to use Direct stram copy so they are essential for editing.

In what way are the keyframes "gone" ???

Do you mean that inside Avidemux the frame-types aren't displayed anymore when using Avisynth input? If so, I can tell you that this is perfectly normal ;)

It's because now Avisynth handles the decoding and sends "raw" (uncompressed) frames to Avidemux, so Avidemux cannot know the frame type. Also the "Copy" mode won't work (as expected).

STFU
29th September 2010, 21:53
Do you mean that inside Avidemux the frame-types aren't displayed anymore when using Avisynth input? If so, I can tell you that this is perfectly normal ;)

It's because now Avisynth handles the decoding and sends "raw" (uncompressed) frames to Avidemux, so Avidemux cannot know the frame type. Also the "Copy" mode won't work (as expected).

Yes frame types are all the same and thus I can't move to the next keyframe + as a result of that the copy function doesn't work, I assume this is the same with DGAVCIndex), cause I haven't installed those plugins yet, if so I guess I just use the version 6 beta and wait for the final version., thanks

LoRd_MuldeR
29th September 2010, 22:08
Yes frame types are all the same and thus I can't move to the next keyframe + as a result of that the copy function doesn't work, I assume this is the same with DGAVCIndex), cause I haven't installed those plugins yet, if so I guess I just use the version 6 beta and wait for the final version., thanks

I doesn't matter which source filters you use in Avisynth. The way things work is always the same:

Avisynth (more specifically the Avisynth source filter in use) will handle the decoding and sends the uncompressed data as "raw" frames to the host application, for example to Avidemux.

Consequently the host application (e.g. Avidemux) cannot know the frame type and thus cannot "jump to the next key-frame".

Another consequence is that when using Avisynth input, the "Copy" mode would save "raw" (uncompressed) data to the file. Therefore Avisynth input is only suitable for re-encoding.

STFU
29th September 2010, 22:19
I doesn't matter which source filters you use in Avisynth. The way things work is always the same:

Avisynth (more specifically the Avisynth source filter in use) will handle the decoding and sends the uncompressed data as "raw" frames to the host application, for example to Avidemux.

Consequently the host application (e.g. Avidemux) cannot know the frame type and thus cannot "jump to the next key-frame".

Another consequence is that when using Avisynth input, the "Copy" mode would save "raw" (uncompressed) data to the file. Therefore Avisynth input is only suitable for re-encoding.

Well at least now I got a backup plan for when certain files won't agree with me.:)