VideoHelp Forum
+ Reply to Thread
Results 1 to 26 of 26
Thread
  1. Command:
    Code:
    x265.exe --input "H:/Frames/S01E01-%01d.png" --input-res 2880x1920 --fps 24000/1001 --crf 20.5 --preset slow --output-depth 10 --rd 6 --ctu 32 --max-tu-size 16 --tu-intra-depth 2 --tu-inter-depth 2 --psy-rdoq 5 --no-rect --aq-mode 2 --subme 5 --merange 92 --bframes 8 --rc-lookahead 60 --lookahead-slices 2 --ref 5 --deblock -3:-3 --limit-sao --psy-rd 1.55 --no-strong-intra-smoothing -o "encoded.hevc"
    It returns:
    Code:
    x265 [error]: unable to open input file <H:/Frames/S01E01-%01d.png>
    Is it not supported or am I missing something?
    Last edited by PRAGMA; 15th Apr 2023 at 04:33.
    Quote Quote  
  2. Try "\" instead of "/" ? You have less than 10 frames to input? %01d specifies a single digit.
    Quote Quote  
  3. Unless your x265.exe binary has been compiled with support to read image sequences, it won't work .

    Usually they are compiled to only accept Y4M or YUV input . You can check with x265 --fullhelp

    Normally you'd use something else read the image sequence (e.g. ffmpeg, or avisynth, or vapoursynth) and pipe to x265 ; (or use ffmpeg libx265 directly)
    Quote Quote  
  4. Originally Posted by poisondeathray View Post
    Unless your x265.exe binary has been compiled with support to read image sequences, it won't work .

    Usually they are compiled to only accept Y4M or YUV input . You can check with x265 --fullhelp

    Normally you'd use something else read the image sequence (e.g. ffmpeg, or avisynth, or vapoursynth) and pipe to x265 ; (or use ffmpeg libx265 directly)
    libx265 is the same as x265.exe? And if so, how would I pass x265.exe's settings to do with encoding over to ffmpeg?
    Quote Quote  
  5. Originally Posted by jagabo View Post
    Try "\" instead of "/" ? You have less than 10 frames to input? %01d specifies a single digit.
    Correct, but if you go more than 9, it will just continue as the digit, no prefix 0's.
    Quote Quote  
  6. Originally Posted by PRAGMA View Post
    Originally Posted by poisondeathray View Post
    Unless your x265.exe binary has been compiled with support to read image sequences, it won't work .

    Usually they are compiled to only accept Y4M or YUV input . You can check with x265 --fullhelp

    Normally you'd use something else read the image sequence (e.g. ffmpeg, or avisynth, or vapoursynth) and pipe to x265 ; (or use ffmpeg libx265 directly)
    libx265 is the same as x265.exe? And if so, how would I pass x265.exe's settings to do with encoding over to ffmpeg?


    Based the same code; almost any setting from x265 can be used in ffmpeg libx265 with -x265-params . But the syntax is slightly different, and some settings are reflected in "normal" ffmpeg settings like -crf, but others must be specified in -x265-params

    So if you feel more comfortable with x265 syntax, it might be easier for you to pipe ffmpeg to x265 (ie. get ffmpeg to read the image sequence to send to x265)

    But you have some other issues - a PNG sequence (I'm assuming is 8bit) will be RGB, but you have not specified the output format conversion . I'm assuming it's YUV420P10 . How you want convert from RGB => YUV420P10 isn't specified, in terms of matrix, transfer, primaries.


    Originally Posted by PRAGMA View Post

    Correct, but if you go more than 9, it will just continue as the digit, no prefix 0's.

    So what do you have exactly ?

    (ignoring the prefix S01E01- )
    1.png
    .
    .
    .
    9.png
    10.png
    11.png
    .
    .


    If that's the case, it won't work (unless you use some python scripting, maybe clique). Easier use a batch renamer like bulk rename utility to put the proper placeholder /padding digits
    Quote Quote  
  7. Originally Posted by poisondeathray View Post
    But you have some other issues - a PNG sequence (I'm assuming is 8bit) will be RGB, but you have not specified the output format conversion . I'm assuming it's YUV420P10 . How you want convert from RGB => YUV420P10 isn't specified, in terms of matrix, transfer, primaries.
    Identified with image magick:
    Code:
    S01E01-1.png PNG 2880x1920 2880x1920+0+0 8-bit sRGB 59454B 0.000u 0:00.001
    I just want the usual color data. Whatever would be used on a general Blu-ray. The content is Animation.
    And the numbers of the files are actually correct to %01d, these frame names were done via ffmpeg %01d.
    But yeah I can pad them if needed, not hard.

    But how would I pipe the frames then? :/
    Last edited by PRAGMA; 15th Apr 2023 at 04:25.
    Quote Quote  
  8. Actually I was wrong - you don't need to pad them. A quick test looks like it will read it ok with ffmpeg

    Regular HD BD will be YUV using Rec 709 . But 2880x1920 is non standard resolution . UHD would typically use Rec 2020
    Quote Quote  
  9. Originally Posted by poisondeathray View Post
    Actually I was wrong - you don't need to pad them. A quick test looks like it will read it ok with ffmpeg

    Regular HD BD will be YUV using Rec 709 . But 2880x1920 is non standard resolution . UHD would typically use Rec 2020
    This isnt for use on a BluRay, but I wish to typically use BluRay standards in some areas like that.
    Resolution I will be changing to 1620x1080 using -vf scale though.

    And great that I dont need to mess with padding
    So to pipe, would I just need to do:
    Code:
    ffmpeg <all my shit> | x265.exe --input - --frames all bla bla
    ?
    Quote Quote  
  10. Yes , it would look like this , you can add w=:h= to -vf scale in ffmpeg (it's already used to convert RGB to YUV using 709 below) . But then you have to adjust the x265 part to reflect the changes

    In theory, Y4M is supposed to communicate everything, dimensions, fps, colorspace, framecount, etc.. but it doesn't always - so more often than not I find you have to specify them on the x265 end as well

    Code:
    ffmpeg -r 24000/1001 -i "S01E01-%01d.png" -vf scale=out_color_matrix=bt709:flags=bicubic+accurate_rnd+full_chroma_int+full_chroma_inp,format=yuv420p10 -strict -1 -f yuv4mpegpipe - | "x265" --input - --y4m --input-depth 10 --input-csp 1 --input-res 2880x1920 --fps 24000/1001 --crf 20.5 --preset slow --output-depth 10 --rd 6 --ctu 32 --max-tu-size 16 --tu-intra-depth 2 --tu-inter-depth 2 --psy-rdoq 5 --no-rect --aq-mode 2 --subme 5 --merange 92 --bframes 8 --rc-lookahead 60 --lookahead-slices 2 --ref 5 --deblock -3:-3 --limit-sao --psy-rd 1.55 --no-strong-intra-smoothing --colorprim bt709 --transfer bt709 --colormatrix bt709 --sar 1:1 -o "encoded.hevc"
    I just copied your command line, but you need to a few more things on the x265 side to make the pipe work

    (also added colormatrix flags, sar flags - but those are not necessary for it to work, just for completeness)
    Quote Quote  
  11. Originally Posted by poisondeathray View Post
    Yes , it would look like this , you can add w=:h= to -vf scale in ffmpeg (it's already used to convert RGB to YUV using 709 below) . But then you have to adjust the x265 part to reflect the changes

    In theory, Y4M is supposed to communicate everything, dimensions, fps, colorspace, framecount, etc.. but it doesn't always - so more often than not I find you have to specify them on the x265 end as well

    Code:
    ffmpeg -r 24000/1001 -i "S01E01-%01d.png" -vf scale=out_color_matrix=bt709:flags=bicubic+accurate_rnd+full_chroma_int+full_chroma_inp,format=yuv420p10 -strict -1 -f yuv4mpegpipe - | "x265" --input - --y4m --input-depth 10 --input-csp 1 --input-res 2880x1920 --fps 24000/1001 --crf 20.5 --preset slow --output-depth 10 --rd 6 --ctu 32 --max-tu-size 16 --tu-intra-depth 2 --tu-inter-depth 2 --psy-rdoq 5 --no-rect --aq-mode 2 --subme 5 --merange 92 --bframes 8 --rc-lookahead 60 --lookahead-slices 2 --ref 5 --deblock -3:-3 --limit-sao --psy-rd 1.55 --no-strong-intra-smoothing --colorprim bt709 --transfer bt709 --colormatrix bt709 --sar 1:1 -o "encoded.hevc"
    I just copied your command line, but you need to a few more things on the x265 side to make the pipe work

    (also added colormatrix flags, sar flags - but those are not necessary for it to work, just for completeness)
    Ok this is what I resulted with:
    Code:
    "bin/ffmpeg.exe" -r 24000/1001 -i "H:/1; ESRGAN/[] OUTPUT/S01E01-%%01d.png" -vf scale=1620:-2,out_color_matrix=bt709:flags=bicubic+accurate_rnd+full_chroma_int+full_chroma_inp,format=yuv420p10 -strict -1 -f yuv4mpegpipe - | "bin/x265.exe" --input - --y4m --input-depth 10 --input-csp 1 --input-res 1620x1080 --fps 24000/1001 --crf 20.5 --preset slow --output-depth 10 --rd 6 --ctu 32 --max-tu-size 16 --tu-intra-depth 2 --tu-inter-depth 2 --psy-rdoq 5 --no-rect --aq-mode 2 --subme 5 --merange 92 --bframes 8 --rc-lookahead 60 --lookahead-slices 2 --ref 5 --deblock -3:-3 --limit-sao --psy-rd 1.55 --no-strong-intra-smoothing --colorprim bt709 --transfer bt709 --colormatrix bt709 --sar 1:1 -o "encoded.hevc"
    It returns the following error on FFMPEG:
    Code:
    [AVFilterGraph @ 000002a1a031ac40] No such filter: 'out_color_matrix'
    Error reinitializing filters!
    Failed to inject frame into filter network: Invalid argument
    Error while processing the decoded data for stream #0:0
    Quote Quote  
  12. Oh I realized its meant to be like:
    Code:
    -vf scale=w=1620:h=-2:out_color_matrix=bt709:
    Quote Quote  
  13. Yes, out_color_matrix is a -vf scale argument

    And Y4M does work here for conveying the input info from ffmpeg (except frame count) . But it might depend on the specific ffmpeg or x265 binary(I've had it not work before in the past, and you had to specify those input options)

    But I found you did NOT need to specify input options (depth, colorspace, resolution, fps) , as they were conveyed by the --y4m pipe correctly

    ie you can omit these
    --input-depth 10 --input-csp 1 --input-res 2880x1920 --fps 24000/1001
    Quote Quote  
  14. Originally Posted by poisondeathray View Post
    But I found you did NOT need to specify input options (depth, colorspace, resolution, fps) , as they were conveyed by the --y4m pipe correctly

    ie you can omit these
    --input-depth 10 --input-csp 1 --input-res 2880x1920 --fps 24000/1001
    What is input csp if I may ask? Im going to go test this out right now
    Last edited by PRAGMA; 15th Apr 2023 at 04:27.
    Quote Quote  
  15. Sweet this does seem to not need those entries, but yeah I get what you mean where it sometimes may not be able to inherit.
    Anyway, dont I need to set SAR and DAR to 3:2? DAR isnt set at all here, maybe its calculated against the w/h? (1.5)?
    Quote Quote  
  16. Originally Posted by PRAGMA View Post

    What is input csp if I may ask? Im going to go test this out right now
    It's in the --fullhelp

    Code:
       --input-csp <string>          Chroma subsampling, auto-detected if Y4M
                                     0 - i400 (4:0:0 monochrome)
                                     1 - i420 (4:2:0 default)
                                     2 - i422 (4:2:2)
                                     3 - i444 (4:4:4)
    4:2:0 is the most common format for x265 10bit , that's what ffmpeg -vf scale was doing with format=yuv420p10 . Earlier I said : "You have not specified the output format conversion . I'm assuming it's YUV420P10 "

    If you wanted something different , change it
    Quote Quote  
  17. Originally Posted by PRAGMA View Post
    Sweet this does seem to not need those entries, but yeah I get what you mean where it sometimes may not be able to inherit.
    Anyway, dont I need to set SAR and DAR to 3:2? DAR isnt set at all here, maybe its calculated against the w/h? (1.5)?
    Normally this resolution of animation would be square pixel . So you 'd set the --sar to 1:1 . That's all you need to do . The DAR is automatically 1.5 then

    Display Aspect Ratio = Frame Aspect Ratio * Sample Aspect Ratio
    DAR = FAR * SAR

    1.5 = 2880/1920 * 1/1
    Quote Quote  
  18. Originally Posted by poisondeathray View Post
    It's in the --fullhelp

    Code:
       --input-csp <string>          Chroma subsampling, auto-detected if Y4M
                                     0 - i400 (4:0:0 monochrome)
                                     1 - i420 (4:2:0 default)
                                     2 - i422 (4:2:2)
                                     3 - i444 (4:4:4)
    4:2:0 is the most common format for x265 10bit , that's what ffmpeg -vf scale was doing with format=yuv420p10 . Earlier I said : "You have not specified the output format conversion . I'm assuming it's YUV420P10 "

    If you wanted something different , change it
    Oh sweet command, also Im not sure which color profile I even want, All im aware is that the source (dvd) is the usual yuv420p8, (BT.601 NTSC), but after my editing, it results in the format I showed you earlier (rgb p8?). With this color convert, if I select one I shouldn't, how would I know? Like how would I know which to choose? (Also the program am using to end up with an edited image cannot result in a non rgb image, it isnt changeable due to how it works)
    Last edited by PRAGMA; 15th Apr 2023 at 04:28.
    Quote Quote  
  19. Originally Posted by PRAGMA View Post

    Oh sweet command, also Im not sure which color profile I even want, All im aware is that the source (dvd) is the usual yuv420p8, (BT.601 NTSC), but after my editing, it results in the format I showed you earlier (rgb p8?). With this color convert, if I select one I shouldn't, how would I know? Like how would I know which to choose? (Also the program am using to end up with an edited image cannot result in a non rgb image, it isnt changeable due to how it works)
    Everything for consumer distribution is 4:2:0 . UHD BD is even 4:2:0, but 10bit . That's what I recommend you use 10bit 4:2:0 . 10bit is becoming more and more common (it's quite common for HEVC), and your commandline in the 1st post used 10bit

    Other subsampling (4:2:2, 4:4:4) might not be as widely supported by decoders, hardware chips , consumer TV's etc.. So it's also dependent on what the audience is or how it's going to be played

    If you need wide audience compatibility , right now - you should use 8bit 4:2:0 AVC, not HEVC

    If it's just for personal use, full color 4:4:4 would be better, especially for animation, but compression is worse (larger filesizes)
    Quote Quote  
  20. Originally Posted by poisondeathray View Post
    Originally Posted by PRAGMA View Post

    Oh sweet command, also Im not sure which color profile I even want, All im aware is that the source (dvd) is the usual yuv420p8, (BT.601 NTSC), but after my editing, it results in the format I showed you earlier (rgb p8?). With this color convert, if I select one I shouldn't, how would I know? Like how would I know which to choose? (Also the program am using to end up with an edited image cannot result in a non rgb image, it isnt changeable due to how it works)
    Everything for consumer distribution is 4:2:0 . UHD BD is even 4:2:0, but 10bit . That's what I recommend you use 10bit 4:2:0 . 10bit is becoming more and more common (it's quite common for HEVC), and your commandline in the 1st post used 10bit

    Other subsampling (4:2:2, 4:4:4) might not be as widely supported by decoders, hardware chips , consumer TV's etc.. So it's also dependent on what the audience is or how it's going to be played
    Perfect thank you!
    So with my command, on animation (Source material is American Dad S01E01 from American Dad Season 1 DVD), is there anything off about any command im doing? Or any recommendation? Youve been super helpful so far btw
    Quote Quote  
  21. I added some more comments above on compatibility and format decisions above ^


    First, I would get the processing correct. That's the most important. IIRC American Dad DVD has many problems (or maybe it was only certain seasons, or certain studio releases ? )

    If it's a dvd source, then 4:2:0 is fine, 10bit will help with compression efficiency and banding issues . So that's a good choice if there were not target compatibility issues

    Personally , I probably wouldn't upscale it

    I don't deal much with simple cartoons like that - so I cannot comment too much on what is "ideal" in terms of encoding settings
    Quote Quote  
  22. Originally Posted by poisondeathray View Post
    I added some more comments above on compatibility and format decisions above ^


    First, I would get the processing correct. That's the most important. IIRC American Dad DVD has many problems (or maybe it was only certain seasons, or certain studio releases ? )

    If it's a dvd source, then 4:2:0 is fine, 10bit will help with compression efficiency and banding issues . So that's a good choice if there were not target compatibility issues

    Personally , I probably wouldn't upscale it

    I don't encode much simple cartoons, so I cannot comment too much on what is "ideal"
    Yes so, what im even doing here is I trained a GAN network model against the DVDs and HD copies of American Dad, once it was trained to a high degree (took me weeks), I ran it on frames of S01E01, and the result was INSANE.
    Image
    [Attachment 49506 - Click to enlarge]


    So im trying to efficiently encode these resulting files into x265
    The model trains in a x4 configuration (i can do x2 instead, but its less efficient), so with the resulting 2880x1920, I simply downscale it to 1620x1080 (3:2 ratio here as it seems it was animated in 3:2, it looks way better in 3:2 than 4:3, looks more like the latest seasons.)

    So yeah, its going very well so far
    Quote Quote  
  23. Which GAN, or a custom one ?

    What was the hardware setup to train that took weeks ?


    Can post some comparison frames?
    Quote Quote  
  24. Originally Posted by poisondeathray View Post
    Which GAN, or a custom one ?

    What was the hardware setup to train that took weeks ?


    Can post some comparison frames?
    I trained ESRGAN (using SRRDB Net), and I used BasicSR to do so.
    My setup is a GTX 1080ti running off of CUDA 10.
    It took weeks because I left it training for a long time on purpose to be more efficient.
    And sure,

    Image
    [Attachment 49507 - Click to enlarge]

    Image
    [Attachment 49508 - Click to enlarge]


    Image
    [Attachment 49510 - Click to enlarge]

    Image
    [Attachment 49509 - Click to enlarge]
    Last edited by PRAGMA; 15th Apr 2023 at 04:30.
    Quote Quote  
  25. It does a good job - especially on the halos , ringing, edge artifacts
    Quote Quote  
  26. Originally Posted by poisondeathray View Post
    It does a good job - especially on the halos , ringing, edge artifacts
    Yes, the cleanup was spectacular.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!