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. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
VapourSynth Script Problem
I am having the same problem from here for VapourSynth scripts. How do I make it have the same keyframes as the input video?
Here's my script, by the way. Code:
from vapoursynth import core clip = core.ffms2.Source(r"video.mkv") clip = core.sub.ImageFile(clip, file = r"subtitle.sup") clip.set_output() Last edited by jay123210599; 18th October 2024 at 14:02. |
|
|
|
|
|
#2 | Link | ||
|
Registered User
Join Date: Sep 2007
Posts: 5,669
|
Quote:
Quote:
Or do you mean same position of keyframes , but re-encoded as new keyframes ? If so, you need to do that with the encoder - specifying keyframes has nothing to do with scripts because everything is uncompressed . For example, if you were using something like x264, x265 to encode - you can specify keyframe positions with a --qpfile . Use search for more information, it has been discussed in other threads |
||
|
|
|
|
|
#4 | Link | ||
|
Registered User
Join Date: Sep 2007
Posts: 5,669
|
Quote:
If source already has flags, source filters like lsmash, ffms2 should automatically read the flags and put it into the script Otherwise you can use core.std.SetFrameProp to set or override them http://www.vapoursynth.com/doc/funct...frameprop.html eg. Code:
clip = core.std.SetFrameProp(clip, prop="_Matrix", intval=1) #mark 709 clip = core.std.SetFrameProp(clip, prop="_Transfer", intval=1) #mark 709 clip = core.std.SetFrameProp(clip, prop="_Primaries", intval=1) #mark 709 Quote:
Y410 is the fourcc code for 10bit 4:4:4 YUV |
||
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
So it's the same thing? Where can I find more information about fourcc codes like Y410?
I also added core.std.SetFrameProp to get 709, but when I added the script to VirtualDub2, I still got YUV420 without it by default. Last edited by jay123210599; 19th October 2024 at 23:50. |
|
|
|
|
|
#6 | Link | |||
|
Registered User
Join Date: Sep 2007
Posts: 5,669
|
Quote:
https://learn.microsoft.com/en-us/wi...-video-formats Quote:
Quote:
709 has nothing to do with YUV420 vs. YUV444 . Both can be either 709 or something else. They are independent variables. 420 vs. 444 refers to the chroma subsampling How are you determining it's YUV420 ? Is it the same script as above ? Is the source 10bit444? When you open the vpy script in vdub2, what does file=>file information say under decompressor ? If it's Y410 , then it's correct. Whatever you're doing afterwards is convert it from Y410 to YUV420 |
|||
|
|
|
|
|
#7 | Link | |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
Quote:
https://imgur.com/TxKC0aW |
|
|
|
|
|
|
#8 | Link | |
|
Registered User
Join Date: Sep 2007
Posts: 5,669
|
Quote:
It works for me and shows Y410 In general, to debug a script you check the output of each line of the script , 1 at a time . You can comment out lines then uncomment them 1 at a time. You can use vspipe or if you prefer vdub2. Maybe your video wasn't 10bit444 to begin with. eg. check just the source filter, comment out the sub Maybe you mixed up videos or scripts (again). Double check before posting Code:
from vapoursynth import core clip = core.ffms2.Source(r"video.mkv") #clip = core.sub.ImageFile(clip, file = r"subtitle.sup") clip.set_output() |
|
|
|
|
|
|
#9 | Link | |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
Quote:
Code:
Format : AVC Format/Info : Advanced Video Codec Format profile : High@L4.1 Format settings : CABAC / 4 Ref Frames Format settings, CABAC : Yes Format settings, Reference frames : 4 frames Format settings, Slice count : 4 slices per frame Codec ID : V_MPEG4/ISO/AVC Duration : 24 min 27 s Bit rate mode : Variable Bit rate : 21.6 Mb/s Maximum bit rate : 39.0 Mb/s Width : 1 920 pixels Height : 1 080 pixels Display aspect ratio : 16:9 Frame rate mode : Constant Frame rate : 23.976 (24000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.435 Time code of first frame : 00:59:59:00 Stream size : 3.70 GiB (85%) Language : English Default : No Forced : No Original source medium : Blu-ray |
|
|
|
|
|
|
#10 | Link | ||
|
Registered User
Join Date: Sep 2007
Posts: 5,669
|
Quote:
vdub2 does not read props such as 709 colorimetery data in the script. Again, script frame props are the least reliable method of conveying the information Refer your other post and the replies, especially #11 http://forum.doom9.org/showthread.php?t=185812 Quote:
|
||
|
|
|
|
|
#11 | Link | |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
Quote:
|
|
|
|
|
|
|
#12 | Link | |
|
Registered User
Join Date: Sep 2007
Posts: 5,669
|
Quote:
I don't think either vpy demuxer (there are 2 versions) for ffmpeg can do it yet |
|
|
|
|
|
|
#14 | Link |
|
Registered User
Join Date: May 2011
Posts: 398
|
Acknowledging or not reading "709" color flag is NOT that important, you can do things manually flagging it during encoding in your encoder, you should be in a habit to do that anyway. I wish a set that flag decades ago for SD videos every time, which I did not.
If your virtualdub is not able to set preview for BT709, and it is "hardcoded" to BT601, then do not use it for preview or perhaps even using its filters. Encoding your vapoursynth script AND flagging "709" color space in encoding settings should be ok. And as you were told, there is also uncertainty on a customer side, where previewing app would not read that flag or decided to use BT601 instead. Learn to use vspipe command lines for vapoursynth scripts. That is why vspipe was created by vapoursynth author, to serve vapoursynth video or audio nodes to other apps\encoders. Last edited by _Al_; 21st October 2024 at 23:29. |
|
|
|
|
|
#15 | Link | |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
Quote:
|
|
|
|
|
|
|
#16 | Link | |
|
Donor
![]() Join Date: Jun 2024
Location: South Africa
Posts: 671
|
Quote:
Code:
vspipe -c y4m Script.vpy - | ffmpeg -i - -c:v libx264 -crf 18 OUTPUT.mp4 Last edited by GeoffreyA; 26th October 2024 at 14:03. |
|
|
|
|
|
|
#17 | Link | |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
Quote:
|
|
|
|
|
|
|
#18 | Link |
|
Registered User
Join Date: May 2011
Posts: 398
|
Yes, that seems to flag matrix as BT709 into AVC stream.
Or if using x264 encoder, you can add in settings, using configure button, into Extra command line: --colormatrix bt709 --colorprim bt709 --transfer bt709 to flag color primaries and transfer also |
|
|
|
|
|
#19 | Link | |
|
Registered User
Join Date: Apr 2024
Posts: 501
|
Quote:
Code:
clip = core.std.SetFrameProp(clip, prop="_Matrix", intval=1) #mark 709 clip = core.std.SetFrameProp(clip, prop="_Transfer", intval=1) #mark 709 clip = core.std.SetFrameProp(clip, prop="_Primaries", intval=1) #mark 709 |
|
|
|
|
|
|
#20 | Link |
|
Registered User
Join Date: May 2011
Posts: 398
|
If you do what was just confirmed in VirtualDub2, then strictly no.
But it is important for a vapoursynth previewers, because they have to present video on screen, so there has to be conversion to rgb, and you need at least matrix to convert to rgb. If not provided, matrix is defaulted/guessed. Also if not set, vapoursynth will object if changing formats to rgb within script. It might be a good habit to set those props like that if you are sure those values are proper, even if VirtualDub2 ignores them. |
|
|
|
![]() |
| Tags |
| colorspace, frame accurate, scripts, vapoursynth editor |
| Thread Tools | |
| Display Modes | |
|
|