Log in

View Full Version : Troubles encoding a HD h264 DVB recording


kalehrl
27th February 2012, 16:13
Yesterday I tried to do my first HD h264 mkv encode but it didn't go well. In the past I successfully encoded SD h264 mkvs using MeGUI.
I captured a DVB full HD recording in a ts file.
The specs are these:
General
ID : 1 (0x1)
Complete name : D:\Dreambox\movie\convertxtodvd\Nat Geo Wild HD - Ultimate Predator (02).ts
Format : MPEG-TS
File size : 3.86 GiB
Duration : 44mn 59s
Overall bit rate : 12.3 Mbps

Video
ID : 513 (0x201)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main@L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : 27
Duration : 44mn 59s
Bit rate : 11.4 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
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
Bits/(Pixel*Frame) : 0.221
Stream size : 3.60 GiB (93%)
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

Audio
ID : 644 (0x284)
Menu ID : 1 (0x1)
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 2
Codec ID : 3
Duration : 44mn 59s
Bit rate mode : Constant
Bit rate : 224 Kbps
Channel(s) : 2 channels
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 72.1 MiB (2%)
Language : English
I extracted the audio and video using a HD Streams Extractor and got a mkv file which plays fine.
SAMPLE (http://www.mediafire.com/?d87ixx51uc56a8d)
I then indexed it and tried to encode it using this script which I created with MeGUI:
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\ffms\ffms2.dll")
FFVideoSource("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", threads=1)
Load_Stdcall_Plugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\yadif\yadif.dll")
Yadif(order=1)
crop( 0, 0, 0, 0)
Spline36Resize(1280,720) # Spline36 (Neutral)
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\avisynth_plugin\FluxSmooth.dll")
FluxSmoothST(7,7) # Medium Noise
After 4.5 hours I got a file which stutters like crazy.
SAMPLE (http://www.mediafire.com/?54c307hna9vd93a)
Instead of 25fps it now reports 50fps.
I also tried playing the avs script using MPC and there it also stutters. Tried also DSS2 or DirectShowSource but I get the same stuttering.

Thank you for your opinions.

Didée
27th February 2012, 16:54
ffms2 woes. Always check what you get before sending it on the long journey.

I'm not an expert on ffms2 usage (using DGDecodeNV when possible). With a quick try, I got the same problem as you did. It did work correctly, when doing like so:

(delete the existing *.ffindex file, and then - - )

ffindex("T1_Video - (1)-001.mkv",demuxer="lavf")
ffvideosource("T1_Video - (1)-001.mkv",threads=1,fpsnum=25,fpsden=1)

Further down the road, you're actually dealing with a fieldblended NTSC > PAL conversion. Plain deinterlacing is not good, there still will be stutter and uglyness. You probably need to use Srestore for this video.

kalehrl
27th February 2012, 21:53
Thank you for your answer Didée.
I managed to edit my script the way you showed me and I don't have bad stuttering as before:
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\ffms\ffms2.dll")
ffindex("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", demuxer="lavf")
FFVideoSource("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", threads=1, fpsnum=25, fpsden=1)
Load_Stdcall_Plugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\yadif\yadif.dll")
Yadif(order=1)
#crop
Spline36Resize(1280,720) # Spline36 (Neutral)
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\avisynth_plugin\FluxSmooth.dll")
FluxSmoothST(7,7) # Medium Noise
The output seems slowed down however.
I believe it can be fixed with that Srestore you mentioned.
How should I use it?
I'm sorry but I'm noob when it comes to advanced avisynth usage. :(
I tried putting srestore() at the bottom but avisynth complains.

Didée
27th February 2012, 23:00
Srestore isn't a built-in filter, it's a script function that you need to "Import(...)". Get it from here (http://avisynth.org/mediawiki/Srestore).

Basically, you just use it on a bob-deinterlaced clip:

***source("video.ext")

bob()
Srestore()

So far so good. Now the bad side: it seems Srestore doesn't work all too well on your sample. Somehow it seems they have used a slightly unusual blending pattern. Maybe it's because it's an intro trailer with some funky effects? Combination of both? I can't tell ....

Sure is this: the source is bad quality, and it won't be easy to make something nice out of it.


Welcome to the worl of High Definition - Now you can see the Normconversion-Artifacts so very sharp and clear! (Crap in High Definition still is ... you know what.)

kalehrl
27th February 2012, 23:48
I somehow managed to get past Srestore avisynth error and to load a preview successfully in AvspMod but I still get slow motion.
The script I'm using is this:
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\ffms\ffms2.dll")
ffindex("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", demuxer="lavf")
FFVideoSource("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", threads=1, fpsnum=25, fpsden=1)
Load_Stdcall_Plugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\yadif\yadif.dll")
Yadif(order=1)
#crop
Spline36Resize(1280,720) # Spline36 (Neutral)
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\avisynth_plugin\FluxSmooth.dll")
FluxSmoothST(7,7) # Medium Noise
LoadPlugin("C:\Users\kalehrl\Desktop\masktools-v2.0a48\mt_masktools-26.dll")
Import("D:\Dreambox\movie\convertxtodvd\Srestore.avsi")
bob()
Srestore()
Is there anything wrong in that script?

poisondeathray
28th February 2012, 00:25
I somehow managed to get past Srestore avisynth error and to load a preview successfully in AvspMod but I still get slow motion.
The script I'm using is this:
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\ffms\ffms2.dll")
ffindex("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", demuxer="lavf")
FFVideoSource("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", threads=1, fpsnum=25, fpsden=1)
Load_Stdcall_Plugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\yadif\yadif.dll")
Yadif(order=1)
#crop
Spline36Resize(1280,720) # Spline36 (Neutral)
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\avisynth_plugin\FluxSmooth.dll")
FluxSmoothST(7,7) # Medium Noise
LoadPlugin("C:\Users\kalehrl\Desktop\masktools-v2.0a48\mt_masktools-26.dll")
Import("D:\Dreambox\movie\convertxtodvd\Srestore.avsi")
bob()
Srestore()
Is there anything wrong in that script?

get rid of the yadif(order=1) , this throws away 1/2 the fields . And the resize should come after bob()



LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\ffms\ffms2.dll")
ffindex("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", demuxer="lavf")
FFVideoSource("D:\Dreambox\movie\convertxtodvd\T1_Video - .mkv", threads=1, fpsnum=25, fpsden=1)
Load_Stdcall_Plugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\yadif\yadif.dll")
LoadPlugin("D:\Programs\MeGUI_0.3.5_x86_WithoutInstaller_OfflinePackage\tools\avisynth_plugin\FluxSmooth.dll")
LoadPlugin("C:\Users\kalehrl\Desktop\masktools-v2.0a48\mt_masktools-26.dll")
Import("D:\Dreambox\movie\convertxtodvd\Srestore.avsi")
bob()
Srestore()
Spline36Resize(1280,720) # Spline36 (Neutral)
FluxSmoothST(7,7) # Medium Noise

Didée
28th February 2012, 01:05
I would go as far as to resize to 720 before Srestore, and even less for an analyse clip.

More importantly, Srestore *does* work reasonably with this source. You just need to realise that in this case the original rate wasn't 23.976 FILM, but 29.97 VIDEO(p). :o

[...]

bob(0,0)
Spline36Resize(1280,720) # Spline36 (Neutral)
Srestore(frate=29.97,dclip=bicubicresize(768,432),speed=-1)
FluxSmoothST(7,7) # Medium Noise

kalehrl
28th February 2012, 15:32
Thank you for your advice guys.
I believe I'm going to stick to the original because encoding it would take a lot of time.
How common are bad HD sources like this on European satellite channels?