View Full Version : Avisynth lost frames
vanden
13th July 2013, 12:28
Hello,
Here is my problem, I have videos (from a Sony camera) MTS container:
Format/Info : Advanced Video Codec
Format profile : High@L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 2 frames
Format settings, GOP : M=2, N=13
Codec ID : 27
Bit rate mode : Variable
Bit rate : 21.2 Mbps
Maximum bit rate : 22.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
I use première CS6 to video editing.
As the PC I use is not very powerful I converted the H264 video in Huffyuv (ffdshow).
To do this conversion I use Avisynth.
The problem is : whether with DGAVCindex or DirectShowSource I lost frames !
2 at the beginning of video with DGAVCindex
3 at the end with direcshowsource …
what solution exist ?
Guest
13th July 2013, 13:55
Please post an unprocessed source sample including the start of the file. You can cut it with DGSplit.
vanden
13th July 2013, 14:37
OK, here the sample (http://www.infonetservices02.fr/00001.MTS)
if i demus this file with eac3to :
eac3to v3.27
command line: "C:\Program Files (x86)\MeGUI_2028_x86\tools\eac3to\eac3to.exe" "E:\00001.MTS" 1:"E:\T1_Video - .h264" 2:"E:\T2_Audio - .ac3" -progressnumbers
------------------------------------------------------------------------------
M2TS, 1 video track, 1 audio track, 1 subtitle track, 0:00:07, 50i
1: h264/AVC, 1080i50 (16:9)
2: AC3, 2.0 channels, 256kbps, 48kHz
3: Subtitle (PGS)
[v01] Extracting video track number 1...
[a02] Extracting audio track number 2...
[v01] Creating file "E:\T1_Video - .h264"...
[a02] Creating file "E:\T2_Audio - .ac3"...
Video track 1 contains 364 fields.
eac3to processing took 1 second.
Done.
364 fields = 182 frames
if i load avs script :
http://infonetservices02.free.fr/DGAVCindex.jpg
if i load the mts file in premiere :
http://infonetservices02.free.fr/premiere.jpg
7sec + 7 frames = 7*25 +7 = 175 +7 = 182 frames.
vanden
13th July 2013, 17:21
corrected links errors !
Guest
13th July 2013, 17:42
Please also give us your Avisynth script.
poisondeathray
13th July 2013, 18:05
As the PC I use is not very powerful I converted the H264 video in Huffyuv (ffdshow).
If this is the reason you're doing this, an alternative method is using ffmbc (you can batch convert if it suits your needs)
ffmbc -i input.mts -vcodec ffvhuff -acodec copy -sn output.avi
note: -vcodec huffyuv is 4:2:2 only and will upsample the chroma, you can use that if you want; ffvhuff variant allows 4:2:0
vanden
13th July 2013, 18:06
My Avisynth script (DGAVCindex):
LoadPlugin("C:\Program Files (x86)\MeGUI_2028_x86\tools\dgavcindex\DGAVCDecode.dll")
AVCSource("C:\Users\Erik\Desktop\test\00001.dga")
My .dga file (http://infonetservices02.fr/00001.dga)
My Avisynth script (Directshowsource) :
LoadPlugin("C:\Program Files (x86)\MeGUI_2028_x86\tools\avs\directshowsource.dll")
DirectShowSource("D:\PRIVATE\AVCHD\BDMV\STREAM\00001.MTS", fps=25.000, audio=false, convertfps=true).AssumeFPS(25,1)
Guest
13th July 2013, 22:00
The sample has an open GOP, so the first two frames are B frames. They are not decodable. So DG tools replace them with a copy of the first decodable frame, i.e., frame 2 (0-based). Other tools may throw them away. You aren't losing anything that is actually available in the stream. DirectShowSource() is not frame accurate so anything you get from that is going to be a crap-shoot.
Guest
13th July 2013, 23:47
Hi rean. Of course many camcorders need special handling for joining. But may I ask specifically how Windmotion deals with a leading open GOP as we have here? Thank you.
vanden
14th July 2013, 00:45
You aren't losing anything that is actually available in the stream.
Here the 3 first frames (mts decoded by premiere) :
Frame0 (http://infonetservices02.free.fr/Frame-00.jpg)
Frame1 (http://infonetservices02.free.fr/Frame-01.jpg)
Frame2 (http://infonetservices02.free.fr/Frame-00.jpg)
Her the first frames of my Avisynth script (DGAVCindex) encoded in Huffyuv (ffdshow) and decoded by premiere :
Frame0 (infonetservices02.free.fr/Frame-00-DGAVCindex.jpg)
I have lost 2 frames.
Guest
14th July 2013, 01:12
Of course the program cannot recreate not existing frames from another MTS file. Then what do you do, throw away those frames? Or make up something sensible and include them?
To clarify, I am talking about when your first MTS has an open GOP.
Guest
14th July 2013, 01:15
It's possible the GOP is wrongly marked open. Investigating...
poisondeathray
14th July 2013, 01:16
If you are able to feed your same sample via Avisynth to some other application that sees two correct leading frames (not copies), please tell me about it.
ffmbc decodes this sample as 364 unique fields , or 182 unique frames (when examining the lossless intermediate) , same as premiere - no frames are lost
ffmbc handles interlaced avc transport streams (e.g from some camcorders, sat boxes) that some programs, and source filters have problems with . I have no idea how it works with these problem files. The sources are available.
somebody compiled a ffms2 based on ffmbc (instead of ffmpeg) , but the special whatever-it-is didn't carry through
Guest
14th July 2013, 01:32
Looks like it may be a simple bug in DGDecodeNV. Standby...
Guest
14th July 2013, 02:31
OK, I have it fixed. I forgot in a strategic place that an IDR refreshes everything. :)
I'll link a test version of DGDecodeNV.dll in a while, but just 32-bit. Is that OK?
Guest
14th July 2013, 02:37
Try this:
http://neuron2.net/misc/DGDecodeNV_vanden.zip
I was planning to add an "Output Trimmed VOB" feature, so that together with this fix will make a release.
Please advise your test results on various files. Thank you.
You are out of luck with DGAVCDec. I no longer distribute or maintain it and the source code is not in the public domain.
feisty2
14th July 2013, 08:00
use "LWLibavsource".selecteven for interlaced h264 ts files
vanden
15th July 2013, 10:10
Try this:
http://neuron2.net/misc/DGDecodeNV_vanden.zip
I was planning to add an "Output Trimmed VOB" feature, so that together with this fix will make a release.
Please advise your test results on various files. Thank you.
You are out of luck with DGAVCDec. I no longer distribute or maintain it and the source code is not in the public domain.
I do not understand what to do.
it must use DGIndexNV ?
I do not have a CUDA card.
Edit :
I tested on another PC (with nvidia card) but I get an error :
http://infonetservices02.free.fr/dgindexnv.png
vanden
15th July 2013, 10:34
@ feisty2 : how to use "LWLibavsource" ?
@ poisondeathray : Ok I will test ffmbc
vanden
15th July 2013, 11:13
I tested ffmbc:
ffmbcx64 -i 00001.MTS -vcodec ffvhuff -acodec copy -sn 00001.avi
Indeed, no loss of frames, but the resulting avi file is not opening in premiere !
Edit :
After remux (with no sound) by virtualdub, file is opening in premiere
What does it take command line to exclude the audio ? (or just demux audio).
Is it possible to activate "adaptive huffman table" when encoding the video ?
Guest
15th July 2013, 13:14
I tested on another PC (with nvidia card) but I get an error You need a license that you can obtain at my website.
poisondeathray
15th July 2013, 14:59
What does it take command line to exclude the audio ? (or just demux audio).
-an instead of -acodec copy
Is it possible to activate "adaptive huffman table" when encoding the video ?
Not sure
Or perhaps ffvhuff variant already does
no, ffvhuff == huffyuv + "adaptive huffman tables"
vanden
15th July 2013, 20:12
-an instead of -acodec copy
Thank, it works perfectly.
Or perhaps ffvhuff variant already does
no
add "-context 1" active "adaptive huffman table"
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.