Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th June 2013, 07:49   #61  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,719
Quote:
Originally Posted by VFR maniac View Post
Inversion can be done by 'dominance'.



Even if a source file is TFF, If the first frame consists of two PAFF field coded pictures and the first field is missing, it should be treated as BFF.
Libavcodec returns frames by pair of two field coded picture.
You can see the source is TFF but the recorded and decoded stream is BFF.

source: ... T0 B1 T2 B3 T4 B5 T6 B7 T8 B9 ...
recorded: B1 T2 B3 T4 B5 T6 B7 T8 B9 ... (the first field dropped)
decoded: [B1 T2] [B3 T4] [B5 T6] [B7 T8] [B9 X] ...

For PAFF field coded pictures, there is no concept of field order or field dominance.
They only play role being coded as top field or bottom field.
Thanks, interesting.
Do you believe that TV channels encode in PAFF ?
I believed it was rare.
Music Fan is offline   Reply With Quote
Old 28th June 2013, 07:55   #62  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,719
Quote:
Originally Posted by LigH View Post
The field dominance is an attribute of the video stream, not of the container.

If AssumeBFF().Bob() doubtlessly returns smooth motion, whereas AssumeTFF().Bob() returns a forth-and-back jitter, then it is correct, and the material was recorded using a camera with a dominant bottom field.
Not necessarily, tv channels often do field inversion to mix tff and bff sources (as we can do with video editing softwares).
When I used to record in analog, video was always in tff, for years, and on all channels.
I guess they also chose tff in digital.
Music Fan is offline   Reply With Quote
Old 28th June 2013, 08:58   #63  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,357
Quote:
Originally Posted by Music Fan View Post
Do you believe that TV channels encode in PAFF ?
I believed it was rare.
PAFF is probably more suitable for hardware real-time encoders (per-frame "decision" – possibly always "yes, this frame is interlaced" – is faster than per-macroblock decision). Many AVCHD cameras record PAFF.

If there is enough time to encode the material "offline", broadcasters may use more elaborate encoders; results created by x264 have been spotted in TV broadcasts already.
__

Field inversions ... do you mean wrong flagging (motion analysis reveals TFF order but bitstream flags report BFF), or do you mean a correct TFF/BFF conversion by omitting one field?
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 28th June 2013 at 09:01.
LigH is offline   Reply With Quote
Old 28th June 2013, 10:00   #64  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,719
Quote:
Originally Posted by LigH View Post
do you mean wrong flagging (motion analysis reveals TFF order but bitstream flags report BFF), or do you mean a correct TFF/BFF conversion by omitting one field?
I mean a correct conversion.
So I meant that TV often do that kind of conversion and we can't know if it was filmed in tff or bff.
And as my analog recordings were in tff and as MediaInfo also detects tff for my digital recordings, I was astonished to note that these digital recordings were in bff for Libavcodec.
But VFR maniac has given a good explanation about this phenomenon.

Quote:
Originally Posted by LigH View Post
PAFF is probably more suitable for hardware real-time encoders (per-frame "decision" – possibly always "yes, this frame is interlaced" – is faster than per-macroblock decision). Many AVCHD cameras record PAFF.
Ok, good to know.

Quote:
Originally Posted by LigH View Post
results created by x264 have been spotted in TV broadcasts already
Do you mean some typical x264 defects seen on TV, which means they also use x264 (which is free) ?

Last edited by Music Fan; 28th June 2013 at 11:13.
Music Fan is offline   Reply With Quote
Old 28th June 2013, 10:08   #65  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,357
I mean that there have been broadcasts where the video stream contained metadata revealing x264 as encoder.

Nothing to worry about, x264 has commercial licensing too.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 8th July 2013, 13:56   #66  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,719
Update ;
http://k4095-takuan.blogspot.de/p/blog-page_17.html
Music Fan is offline   Reply With Quote
Old 16th July 2013, 07:40   #67  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,357
There is a report that Apple ProRes videos (e.g. clipcanvas_14348_PRORES_HQ.mov) are incorrectly decoded and deskewed by LWLibavVideoSource (LSMASHSource r632), in contrast to FFVideoSource (FFMS2 v2.18 RC1).
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid
LigH is offline   Reply With Quote
Old 16th July 2013, 14:15   #68  |  Link
VFR maniac
Spinner of yarns
 
VFR maniac's Avatar
 
Join Date: May 2009
Posts: 164
Apple ProRes?
Haha, I guess the strange output from LWLibavVideoSource is high bit-depth interleaved format.
You may feel FFMS2 outputs correctly but, the fact, the output loses accuracy around 2-bit for each Y'CbCr component.
Try format="YUV422P8" or stacked=true.

Edit and Note: currently libavcodec ProRes decoder supports only Y'CbCr 4:2:2 10-bit and 4:4:4 10-bit format with or without alpha channel.
Therefore, LWLibavVideoSource(source="ProRes") always output in interleaved format unless user specifies output format.
And even if ProRes4444 (12-bit) is input, the default output format will be Y'CbCr 4:4:4 10-bit with alpha.
__________________
僕と契約して、L-SMASH developerになってよ!
L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software

Last edited by VFR maniac; 16th July 2013 at 17:07.
VFR maniac is offline   Reply With Quote
Old 24th July 2013, 20:23   #69  |  Link
Selur
Registered User
 
Selur's Avatar
 
Join Date: Oct 2001
Location: Germany
Posts: 6,207
btw. is there some way to roughly predict the size of the LWLibavVideoSource index.
Since I can't specify where the index should be created, I normally use to let LWLibavVideoSource create the index inside the RAM, problem is on large files the index gets to large for Avisynth to handle, so I would like to predict the size before indexing a file so I can decide whether to use LWLibavVideoSource or not.
__________________
Hybrid here in the forum, homepage
Notice: Since email notifications do not work here any more, it might take me quite some time to notice a reply to a thread,..
Selur is offline   Reply With Quote
Old 25th July 2013, 11:10   #70  |  Link
VFR maniac
Spinner of yarns
 
VFR maniac's Avatar
 
Join Date: May 2009
Posts: 164
There is no way to predict the size of the index file.

The index file consists of properties per packet returned by libavformat in the overall stream.
(+plus CODEC specific decoder configurations and libavformat own index entries)
The size doesn't depend on the source file size.
__________________
僕と契約して、L-SMASH developerになってよ!
L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software

Last edited by VFR maniac; 25th July 2013 at 11:13.
VFR maniac is offline   Reply With Quote
Old 4th August 2013, 06:40   #71  |  Link
HolyWu
Registered User
 
HolyWu's Avatar
 
Join Date: Aug 2006
Location: Taiwan
Posts: 757
I encountered a strange issue and could not determine that it's VapourSynth's problem or L-SMASH-Works' problem.

Code:
import vapoursynth as vs
core = vs.get_core()
core.avs.LoadPlugin(r'C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools2.dll')
core.std.LoadPlugin(r'C:\Program Files (x86)\VapourSynth\filters\vslsmashsource.dll')
clip = core.lsmas.LWLibavSource(r'test.mkv', threads=1)
super = core.avs.MSuper(clip, pel=2)
bv = core.avs.MAnalyse(super, isb=True, delta=1)
fv = core.avs.MAnalyse(super, isb=False, delta=1)
clip = core.avs.MDegrain1(clip, super, bv, fv)
clip.set_output()

======================================

vspipe test.vpy - -info
Avisynth Compat: varargs not implemented so I'm just gonna skip importing MStoreVect
Width: 640
Height: 480
Frames: 239
FPS: 24000/1001
Format Name: YUV420P8
Color Family: YUV
Bits: 8
SubSampling W: 1
SubSampling H: 1

======================================

vspipe test.vpy - -y4m | x264_64 --demuxer y4m --output NUL -
Avisynth Compat: varargs not implemented so I'm just gonna skip importing MStoreVect
y4m [info]: 640x480p 0:0 @ 24000/1001 fps (cfr)
y4m [info]: color matrix: undef
x264 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT
x264 [info]: profile High, level 3.0
x264 [info]: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 fade_compensate=0.00 psy_rd=1.00:0.00 mi
xed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=9 loo
kahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 fgo=0 bframes=3 b_pyr
amid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 r
c_lookahead=40 rc=crf mbtree=1 crf=23.0000 qcomp=0.60 qpmin=0:0:0 qpmax=69:69:69 qpstep=4 ip_ratio=1.40 aq=1:1.00 aq-sen
sitivity=10.00 aq-factor=1.00:1.00:1.00 aq2=0 aq3=0
x264 [info]: started at Sun Aug 04 13:00:00 2013
Error: Failed to retrieve frame 簾 with error: lsmas: exceeded the number of frames.
x264 [info]: frame I:1     Avg QP: 9.00  size:   962
x264 [info]: frame P:58    Avg QP: 9.10  size:    29
x264 [info]: frame B:174   Avg QP:12.67  size:    21
x264 [info]: consecutive B-frames:  0.4%  0.0%  0.0% 99.6%
x264 [info]: mb I  I16..4: 100.0%  0.0%  0.0%
x264 [info]: mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:100.0%
x264 [info]: mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.0%  0.0%  0.0%  direct: 0.0%  skip:100.0%
x264 [info]: 8x8 transform intra:0.0%
x264 [info]: coded y,uvDC,uvAC intra: 0.0% 0.0% 0.0% inter: 0.0% 0.0% 0.0%
x264 [info]: i16 v,h,dc,p: 97%  0%  3%  0%
x264 [info]: i8c dc,h,v,p: 100%  0%  0%  0%
x264 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x264 [info]: kb/s:5.13

encoded 233 frames, 100.47 fps, 5.13 kb/s, 6.08 KB
x264 [info]: ended at Sun Aug 04 13:00:02 2013
x264 [info]: encoding duration 0:00:02
It looks like the problem is caused by lsmashsource from the error message in x264. The weird thing is, if I remove all the mvtools stuff and leave only clip = core.lsmas.LWLibavSource(r'test.mkv', threads=1) in the script, it encodes successfully.

Moreover, if I use the AVS version instead of VS version for lsmashsource, like the following, the problem disappears too.
Code:
import vapoursynth as vs
core = vs.get_core()
core.avs.LoadPlugin(r'C:\Program Files (x86)\AviSynth 2.5\plugins\LSMASHSource.dll')
core.avs.LoadPlugin(r'C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools2.dll')
clip = core.avs.LWLibavVideoSource(r'test.mkv', threads=1)
super = core.avs.MSuper(clip, pel=2)
bv = core.avs.MAnalyse(super, isb=True, delta=1)
fv = core.avs.MAnalyse(super, isb=False, delta=1)
clip = core.avs.MDegrain1(clip, super, bv, fv)
clip.set_output()
The version of lsmashsource I use is r662 which is downloaded from http://k4095-takuan.blogspot.tw/p/blog-page_17.html.
HolyWu is offline   Reply With Quote
Old 4th August 2013, 11:15   #72  |  Link
VFR maniac
Spinner of yarns
 
VFR maniac's Avatar
 
Join Date: May 2009
Posts: 164
Quote:
Originally Posted by HolyWu View Post
Code:
lsmas: exceeded the number of frames.
This message means the subsequent filter requests frame number exceeding the number of output frames from vslsmashsource.
For instance, the number of output frames from vslsmashsource is 239, and the filter requests 240-th frame, then vslsmashsource will return this error message.

I guess mvtools or VapourSynth's AviSynth compatible module causes the problem.
__________________
僕と契約して、L-SMASH developerになってよ!
L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software
VFR maniac is offline   Reply With Quote
Old 4th August 2013, 11:48   #73  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,279
Quote:
Originally Posted by VFR maniac View Post
This message means the subsequent filter requests frame number exceeding the number of output frames from vslsmashsource.
For instance, the number of output frames from vslsmashsource is 239, and the filter requests 240-th frame, then vslsmashsource will return this error message.

I guess mvtools or VapourSynth's AviSynth compatible module causes the problem.
Just return the last frame when that happens. Vs allows frames beyond the end to be requested.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 4th August 2013, 12:06   #74  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,719
Hi,
how to configure LWLibavVideoSource to open VFR h264 ?
Music Fan is offline   Reply With Quote
Old 4th August 2013, 14:20   #75  |  Link
VFR maniac
Spinner of yarns
 
VFR maniac's Avatar
 
Join Date: May 2009
Posts: 164
@ Myrsloik
Should return with error or warning message?

@ Music Fan
I can't get what you mean.
__________________
僕と契約して、L-SMASH developerになってよ!
L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software
VFR maniac is offline   Reply With Quote
Old 4th August 2013, 14:31   #76  |  Link
Music Fan
Registered User
 
Join Date: May 2009
Location: Belgium
Posts: 1,719
Quote:
Originally Posted by VFR maniac View Post
@ Music Fan
I can't get what you mean.
I want to open a vfr video with LWLibavVideoSource, is there anything to add at the end of the 1st line of the script ?
For comparison, when it's done with DirectShowSource, one has to add convertfps=true.
Is there anything like this for LWLibavVideoSource ?
Music Fan is offline   Reply With Quote
Old 4th August 2013, 14:47   #77  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Ikea Chair
Posts: 2,279
Quote:
Originally Posted by VFR maniac View Post
@ Myrsloik
Should return with error or warning message?
As I said, filters are allowed to request frames beyond the end. No errors or warnings.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 5th August 2013, 09:38   #78  |  Link
LigH
German doom9/Gleitz SuMo
 
LigH's Avatar
 
Join Date: Oct 2001
Location: Germany, rural Altmark
Posts: 6,357
Current versions of L-SMASH Works appears to be r662.

Changelog is probably best read in the Github.
__

A user in the german doom9/Gleitz forum is reporting intermittent issues with batch-converted DVB-S2 720p50 movies being encoded twice as long, sometimes repeated, sometimes with green blanks. But before your alarm goes off, we are trying to discover the reason (RAM, resident AV, timing issue of indexing different files with always the same temporary name...). Usually a second run returns a correct conversion.
__________________

New German Gleitz board
MediaFire: x264 | x265 | VPx | AOM | Xvid

Last edited by LigH; 5th August 2013 at 09:45.
LigH is offline   Reply With Quote
Old 6th August 2013, 16:14   #79  |  Link
wOxxOm
Oz of the zOo
 
Join Date: May 2005
Posts: 208
Quote:
Originally Posted by VFR maniac View Post
I added supporting of a hack of high bit-depth input between rev594 and rev603.
For interleaved format (at default), only little endianness output is supported currently i.e. LSB comes at the first byte and MSB comes at the second.
Stacked format is also available but direct rendering is always not available if used.
In order to use LW in avisynth to process 10-bit video files with high-bitdepth plugins (like modded dfttest and mdegrain from the Dither package) the output needs to be converted.

Stacked=true: 950 fps (LWLibavVideoSource only) -> 400 fps drop.
Code:
msb = crop(0,0,0,height/2)
lsb = crop(0,height/2,0,0)
stackvertical(mt_lutxy(msb,lsb,"x 8 << y + 2 >>",u=3,v=3),
\ mt_lutxy(msb,lsb,"x 8 << y + 3 &u  6 <<",u=3,v=3))
On default settings it's even slower because of bad avisynth's turn implementation: 110 fps (or 300 fps with FTurn SSE2)
Code:
assumebff.turnleft.separatefields.turnright.assumeframebased
stackvertical( mt_lutxy(selectodd, selecteven, "x 8 << y + 2 >>", u=3,v=3),
\ mt_lutxy(selectodd, selecteven, "x 8 << y + 3 &u  6 <<", u=3,v=3))
BTW, the output of FFVideoSource with 10-bit-to-stacked hack can be used directly by the aforementioned plugins...
It'd be nice if the LW output for 10-bit files in avisynth would match that, since it's not as useful otherwise.

Last edited by wOxxOm; 6th August 2013 at 16:20.
wOxxOm is offline   Reply With Quote
Old 16th August 2013, 22:43   #80  |  Link
VFR maniac
Spinner of yarns
 
VFR maniac's Avatar
 
Join Date: May 2009
Posts: 164
Quote:
Originally Posted by Music Fan View Post
I want to open a vfr video with LWLibavVideoSource, is there anything to add at the end of the 1st line of the script ?
For comparison, when it's done with DirectShowSource, one has to add convertfps=true.
Is there anything like this for LWLibavVideoSource ?
LWLibavVideoSource doesn't support VFR->CFR conversion i.e. doesn't pad frames for VFR source.
It just returns frame by frame.
VFR->CFR conversion is "patches welcome".

Quote:
Originally Posted by wOxxOm View Post
In order to use LW in avisynth to process 10-bit video files with high-bitdepth plugins (like modded dfttest and mdegrain from the Dither package) the output needs to be converted.

Stacked=true: 950 fps (LWLibavVideoSource only) -> 400 fps drop.
Code:
msb = crop(0,0,0,height/2)
lsb = crop(0,height/2,0,0)
stackvertical(mt_lutxy(msb,lsb,"x 8 << y + 2 >>",u=3,v=3),
\ mt_lutxy(msb,lsb,"x 8 << y + 3 &u  6 <<",u=3,v=3))
On default settings it's even slower because of bad avisynth's turn implementation: 110 fps (or 300 fps with FTurn SSE2)
Code:
assumebff.turnleft.separatefields.turnright.assumeframebased
stackvertical( mt_lutxy(selectodd, selecteven, "x 8 << y + 2 >>", u=3,v=3),
\ mt_lutxy(selectodd, selecteven, "x 8 << y + 3 &u  6 <<", u=3,v=3))
BTW, the output of FFVideoSource with 10-bit-to-stacked hack can be used directly by the aforementioned plugins...
It'd be nice if the LW output for 10-bit files in avisynth would match that, since it's not as useful otherwise.
Did you try format="YUV4**P16"?
'format' and 'stacked' are not exclusive option each other.
I have not tested speed comparison though.
__________________
僕と契約して、L-SMASH developerになってよ!
L-SMASH | L-SMASH Works | Opus-in-ISOBMFF specification and reference software

Last edited by VFR maniac; 16th August 2013 at 22:45.
VFR maniac is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 20:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.