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 > VirtualDub, VDubMod & AviDemux

Reply
 
Thread Tools Search this Thread Display Modes
Old 20th September 2020, 23:15   #1  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Encode UHD prores 444(4)

Hi, I am trying to encode a UHD (3840x2160) video filtered with Avisynth+ and encode prores444 (or 4444) but the only thing I can get is the Prores as "YUV 8-bit 4:2:0" to work and the needed info gets lost.

This is how it looks in "External encoder";
-> "Edit external encoder profile", Command Arguments: -f rawvideo -s %(width)x%(height) -r %(fpsnum)/%(fpsden) -i - -c:v prores_ks -profile:v 4 -pix_fmt yuv444p10 "%(tempvideofile)"
Under the "video"-tab I want to use "yuv444p16le - 16-bit YUV 4:4:4" but this just makes VDUB2 crash instantly when trying to encode.
Error: Oops -- VirtualDub has crashed... Or out of memory error.

Just for test I have tried "yuv444p - 8-bit YUV 4:4:4", this gives me a green-blueish tinted image and "yuv422p - 8-bit YUV 4:2:2"
gives me a green-tinted image.

Is it even possible to encode in higher than 8-bit and 4:4:4 prores (or DNXHR) in VirtualDub2 (Build 44282)?

Thanks
anton_foy is offline   Reply With Quote
Old 21st September 2020, 02:43   #2  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Don't use the external encoder.

Use the vdub2 FFMpeg / Apple ProRes option under video=>compression
poisondeathray is offline   Reply With Quote
Old 21st September 2020, 09:49   #3  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
This should work, no idea the for the reason of crash. Do you run x64 version? Otherwise low memory could be the issue.

For the command line you have to also put pix_fmt of the rawvideo:

example ffv1
Code:
-f rawvideo -pix_fmt %(pix_fmt) -s %(width)x%(height) -r %(fpsnum)/%(fpsden) -i - -c:v ffv1 %(tempvideofile)
prores
Code:
-f rawvideo -pix_fmt %(pix_fmt) -s %(width)x%(height) -r %(fpsnum)/%(fpsden) -i - -c:v prores_ks -profile:v 4 -pix_fmt yuv444p10 "%(tempvideofile)"
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 21st September 2020, 16:19   #4  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Or why not use ffmpeg directly with avs input ? What is the reason for the intermediate vdub2 step ?
poisondeathray is offline   Reply With Quote
Old 21st September 2020, 18:46   #5  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Thank you both.

@poisondeathray
When I use the vdub2 FFMpeg / Apple ProRes option under video=>compression and "save video" as video.mov I get memory error "Out of memory (unable to allocate 66359312 bytes)". Too old computer?

I would love to use ffmpeg directly with avs input but all I get is error when I try it: "ffmpeg outputfile #0 does not contain any stream" and it doesn't write any frames.
Code:
ffmpeg prorestest.avs prores_ks -c:v -profile:v 4 -pix_fmt yuv444p10 test.mov
@shekh
I used your line
Code:
-f rawvideo -pix_fmt %(pix_fmt) -s %(width)x%(height) -r %(fpsnum)/%(fpsden) -i - -c:v prores_ks -profile:v 4 -pix_fmt yuv444p10 "%(tempvideofile)"
But I get "Out of memory (unable to allocate 49766415 bytes)".

Last edited by anton_foy; 21st September 2020 at 18:49.
anton_foy is offline   Reply With Quote
Old 21st September 2020, 18:53   #6  |  Link
shekh
Registered User
 
Join Date: Mar 2015
Posts: 775
If you have to run 32-bit, maybe look at Option->Performance->Video buffering (change to minimum 4)
Not sure what else could help to save memory.
__________________
VirtualDub2
shekh is offline   Reply With Quote
Old 21st September 2020, 19:04   #7  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Quote:
Originally Posted by shekh View Post
If you have to run 32-bit, maybe look at Option->Performance->Video buffering (change to minimum 4)
Not sure what else could help to save memory.
Thanks but I get the same memory error. It does not even letting me export as png-sequence...
If I edit my avs-file to 8-bit I have no problem but as soon as I change it to deep color it refuses.
anton_foy is offline   Reply With Quote
Old 21st September 2020, 21:00   #8  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by anton_foy View Post

I would love to use ffmpeg directly with avs input but all I get is error when I try it: "ffmpeg outputfile #0 does not contain any stream" and it doesn't write any frames.
Code:
ffmpeg prorestest.avs prores_ks -c:v -profile:v 4 -pix_fmt yuv444p10 test.mov

Typos ?

It should be like this
Code:
Code:
ffmpeg -i prorestest.avs -c:v prores_ks  -profile:v 4 -pix_fmt yuv444p10 test.mov
poisondeathray is offline   Reply With Quote
Old 21st September 2020, 21:17   #9  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
@poisondeathray
Thanks, I probably do it wrong somehow but I have the avs-script in the same folder as ffmpeg.exe and in the Command Prompt I pasted your line but I now get error:
prorestest.avs: unknown error occured I found another person here in the forums getting this and he renamed ffmpeg.exe to ffmpeg32.exe to make it work but it does not work for me.
anton_foy is offline   Reply With Quote
Old 21st September 2020, 21:37   #10  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Your avisynth build has to match the ffmpeg binary in terms of x86 vs. x64 . eg. If you had avisynth x86 installed, you'd need a ffmpeg x86 binary
poisondeathray is offline   Reply With Quote
Old 21st September 2020, 22:08   #11  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
@poisondeathray
Thank you now it works !!! I had dragged and dropped the exe-file in the wrong place, the old x64 was still there and I mixed them up.
But should it say below input: Stream #0:0 Video: rawvideo (Y3[11][16] / 0x100B3359), yuv420p16le...?
The encoding section shows yuv444p10le which is fine I guess ( because FFMPEG cannot encode prores 4444 in higher than 10 bit?)

Last edited by anton_foy; 21st September 2020 at 22:24.
anton_foy is offline   Reply With Quote
Old 21st September 2020, 22:57   #12  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
all ffmpeg prores encoders currently only support 10bit (prores 4444 and 4444xq are supposed to be 12bit) ; this is well documented and requests have been made to extend proper 12bit support
poisondeathray is offline   Reply With Quote
Old 21st September 2020, 23:02   #13  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Quote:
Originally Posted by anton_foy View Post
But should it say below input: Stream #0:0 Video: rawvideo (Y3[11][16] / 0x100B3359), yuv420p16le...?
The encoding section shows yuv444p10le which is fine I guess ( because FFMPEG cannot encode prores 4444 in higher than 10 bit?)
What are you sending in the avs script ? what does info() say ?

It should be yuv444p10le, not yuv420p16le . Otherwise you are letting ffmpeg downconvert the bit depth and upsample the chroma, instead of specifying how you want it to be done. e.g. what algorithm are you using to upscale ? Did you want to dither down ? What algorithm to dither (or not)

Code:
    Stream #0:0: Video: rawvideo (Y3[0][10] / 0xA003359), yuv444p10le, 3840x2160
, 24 fps, 24 tbr, 24 tbn, 24 tbc

Last edited by poisondeathray; 21st September 2020 at 23:05.
poisondeathray is offline   Reply With Quote
Old 21st September 2020, 23:23   #14  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,988
10 bit is perfectly valid for 4444 and 4444 XQ, they both just happen to support 10 and 12 bit encoding
Blue_MiSfit is offline   Reply With Quote
Old 22nd September 2020, 07:32   #15  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Quote:
Originally Posted by poisondeathray View Post
What are you sending in the avs script ? what does info() say ?

It should be yuv444p10le, not yuv420p16le . Otherwise you are letting ffmpeg downconvert the bit depth and upsample the chroma, instead of specifying how you want it to be done. e.g. what algorithm are you using to upscale ? Did you want to dither down ? What algorithm to dither (or not)

Code:
    Stream #0:0: Video: rawvideo (Y3[0][10] / 0xA003359), yuv444p10le, 3840x2160
, 24 fps, 24 tbr, 24 tbn, 24 tbc
My avs-script ends with:

Code:
ConverttoYUV444()
Convertbits(10, dither=1)
I can post the full script when I come home from work.

EDIT:
Here is my script
Code:
  ### Avisynth+ 3.6.1 (r3300, 3.6, I386) ###
SetFilterMTMode("DEFAULT_MT_MODE", 2)

#Index
LSMASHVideoSource("F:\sony\C1031.mp4")
trim(17,24)

convertbits(16)
Levels(0, 1, 65280, 0, 65280, coring=false, dither=false)

### DENOISE ###
neo_dfttest(sigma=16,sigma2=16,f0beta=1.0,tbsize=1,sbsize=120,sosize=90, y=2 , u=3, v=3) #sbsize=120,sosize=90 / sbsize=24,sosize=18
mergeluma(TemporalSoften(3, 4, 8, mode=2))

### TOPSHARP ###
shrp=sharpen(1.0)
vid1 = last
shine1 = vid1.Overlay(shrp, mode="blend", opacity=1.0) 
emask1 = vid1.mt_edge(mode="prewitt",thy1=0,thy2=65280).mt_expand().fastgaussblur(10)
result1 = mt_merge(vid1,shine1,emask1, U=2,V=2)
merge(result1)

### SHINE ###
blr=mt_expand().Blur(1.56).Blur(1.56).Blur(1.56).Blur(1.56).Blur(1.56).Blur(1.56).Blur(1.56) #BinomialBlur(varY=4.5, varC=6.5, Y=3, U=2, V=2, useMMX=true)
vid = last
shine = vid.Overlay(blr, mode="blend", opacity=0.9)
emask = vid.mt_edge(mode="prewitt",thy1=0,thy2=65280).mt_expand().mt_expand().mt_expand().fastgaussblur(20)
result = mt_merge(vid,shine,emask, U=2,V=2)
return(result)

#Debanding
neo_f3kdb(range=15, Y=45, Cb=30, Cr=30, grainY=0, grainC=0, sample_mode=2, blur_first=true, dynamic_grain=false, mt=true)

#Chroma Upscaling
ConverttoYUV444()

Prefetch(4)
ConvertBits(bits=10, dither=1)

Last edited by anton_foy; 22nd September 2020 at 19:59. Reason: Added the avs-script
anton_foy is offline   Reply With Quote
Old 23rd September 2020, 17:09   #16  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Could the MT-mode interfere with the last part: Converttoyuv444() and Convertbits(bits=10, dither=1)
or is there another reason why FFMPEG interprets my input as "yuv420p16le" instead of "yuv444p10le"?

Thanks
anton_foy is offline   Reply With Quote
Old 23rd September 2020, 18:40   #17  |  Link
Cary Knoop
Cary Knoop
 
Cary Knoop's Avatar
 
Join Date: Feb 2017
Location: Newark CA, USA
Posts: 397
What's the original chroma-subsampling and bit-depth?

Could you show a few seconds of pre and post processing.
Cary Knoop is offline   Reply With Quote
Old 23rd September 2020, 19:00   #18  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Quote:
What's the original chroma-subsampling and bit-depth?

Could you show a few seconds of pre and post processing.
@Cary Knoop
Its footage from my Sony A6300 camera.
XAVC S: 3840 x 2160p / 25 fps (100 Mbps), 4:2:0, 8 bit.

As seen in my avs-script I filter it in 16-bits and then convert into 10-bit yuv444.

Yes I can show before and after clip as soon as I come home from work.
I have imported the clip in Davinci Resolve and compared it to avisynth filtered in 8bit and the new one is indeed in 10 bits. I am just concerned that ffmpeg does not interpret it as yuv444 10-bit input clip which it should.
anton_foy is offline   Reply With Quote
Old 23rd September 2020, 20:27   #19  |  Link
anton_foy
Registered User
 
Join Date: Dec 2005
Location: Sweden
Posts: 702
Here is the link with the videos, processed and unprocessed: https://we.tl/t-yOeb6Tolr4
anton_foy is offline   Reply With Quote
Old 23rd September 2020, 22:37   #20  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,346
Maybe a problem with your ffmpeg binary. What does info() report ?


Code:
Blankclip(pixel_type="YV12").KillAudio()
convertbits(16)
ConverttoYUV444()
Prefetch(4)
ConvertBits(bits=10, dither=1)
For this test script, info() reports YUV444P10 ; and ffmpeg -i input.avs reports yuv444p10le

Why don't you have ConvertBits before prefetch ?
poisondeathray 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 18:34.


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