VideoHelp Forum


Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!


Try StreamFab Downloader and download streaming video from Youtube, Netflix, Amazon! Download free trial.


+ Reply to Thread
Results 1 to 22 of 22
Thread
  1. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Any suggestions of a ffmpeg script to encode a lossless HuffYUV UHD file into a codec suitable for uploading into YouTube, So basically I just want to reduce the file size to stay below the YT file size limit, I would like to keep the 4:2:2 chroma sub and audio as PCM if possible, I've always uploaded lossless HD to YT since bandwidth is not an issue for me but 4k/UHD exceeds YT file size limit for uploading. I know YT compresses everything and makes it much worse, this is the exact reason I keep the file as lossless as possible before uploading so it gets butchered only once. A sample file is attached.
    Image Attached Files
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    What is youtubes bitrate limit ? THe only thing I see is a maximum 256 GB per file
    Quote Quote  
  3. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    My problem is not the bitrate, the file size is the limit.
    Quote Quote  
  4. Something like (in a drag/drop batch file):

    Code:
    ffmpeg -y -i %1 -pix_fmt yuv422p10le ^
        -c:v libx265 -preset slow -profile:v main422-10 -crf 15 -colorspace bt709 ^
        -c:a copy "%~n1.x265.main422-10.mkv"
    That delivered a 5.5 MiB file (from your 245MiB source).
    Quote Quote  
  5. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Originally Posted by dellsam34 View Post
    My problem is not the bitrate, the file size is the limit.
    Well it's related.
    a 30 minute file @ 1000kbs and a 15 minute file at 2000kbps would be about the same size...
    so then the run time AND bit rate become a factor.

    Your file is marked interlaced but it's progressive.
    Encoded it in vdub2 using ffv1 lossless compression @ 422 chroma, PCM audio and received a file at about 55MBs
    I
    Quote Quote  
  6. The AVI file isn't flagged interlaced. MediaInfo always assumes huffyuv in AVI is interlaced.
    Quote Quote  
  7. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Originally Posted by jagabo View Post
    The AVI file isn't flagged interlaced. MediaInfo always assumes huffyuv in AVI is interlaced.
    Good point.
    Quote Quote  
  8. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    I will try both ffmpeg and vdub variants and see which one looks better after an upload.
    Quote Quote  
  9. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Originally Posted by jagabo View Post
    Something like (in a drag/drop batch file):

    Code:
    ffmpeg -y -i %1 -pix_fmt yuv422p10le ^
        -c:v libx265 -preset slow -profile:v main422-10 -crf 15 -colorspace bt709 ^
        -c:a copy "%~n1.x265.main422-10.mkv"
    That delivered a 5.5 MiB file (from your 245MiB source).
    How would I use this for a single file and where to insert the file name?
    Quote Quote  
  10. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I think jagabo's approach is better. Will give you the option to upload much longer files and shorter upload times.
    I don't think it's necessary to keep it lossless, although on my PC, a bit on the slow side, the lossless encoding is quicker
    Quote Quote  
  11. Originally Posted by dellsam34 View Post
    Originally Posted by jagabo View Post
    Something like (in a drag/drop batch file):

    Code:
    ffmpeg -y -i %1 -pix_fmt yuv422p10le ^
        -c:v libx265 -preset slow -profile:v main422-10 -crf 15 -colorspace bt709 ^
        -c:a copy "%~n1.x265.main422-10.mkv"
    That delivered a 5.5 MiB file (from your 245MiB source).
    How would I use this for a single file and where to insert the file name?
    It's a drag-and-drop batch file. Put the code in a bat file (a plain text file with the extension .bat rather than .txt), then drag/drop a video file onto the bat file. Or put the bat file in your Send To folder. Then you can right click on a video file and select Send To -> (name of bat file) from the context menu.

    Of you can type:

    Code:
    ffmpeg -y -i "input.avi" -pix_fmt yuv422p10le -c:v libx265 -preset slow -profile:v main422-10 -crf 15 -colorspace bt709 -c:a copy "output.mkv"
    Last edited by jagabo; 26th Oct 2024 at 21:09.
    Quote Quote  
  12. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    For some reason that -y caracter at the beginning of the the second script did not process the file, so I removed it and it worked, Here is both lossless and encoded files uploaded to YouTube:

    Lossless: https://youtu.be/mGse2ZN94GQ
    Encoded: https://youtu.be/h9j1KNmxnzA
    Quote Quote  
  13. If 256GiB is your problem then i need to ask what kind of length and bitrate are expected to be dealt... Personally if i need to upload something on YT then i prefer encoding speed instead file size (so i prefer preset rather fast/faster than medium/slow) - also i would probably avoid B frames at all (i use only I and P type - my observation leading me that there is less quantizer "pumping" visible in final render).
    Quote Quote  
  14. Small side question: Does it make sense to upload 4:2:2 content to YouTube, afaik. YouTube always converts to 4:2:0?
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  15. Originally Posted by Selur View Post
    Small side question: Does it make sense to upload 4:2:2 content to YouTube, afaik. YouTube always converts to 4:2:0?
    I was wondering the same thing. Especially since the OP appears to be working with upscaled VHS.

    Also, there's a rec.601 vs rec.709 color difference between the two youtube videos in post #12. The command line I gave explicitly flagged the video as rec.709. I assumed that because it was upscaled to 4K, though it's not flagged as such in the earlier huffyuv AVI.

    Originally Posted by dellsam34 View Post
    For some reason that -y caracter at the beginning of the the second script did not process the file
    That's weird because -y tells ffmpeg not to warn you if its output is going to overwrite an existing file, it just overwrites it. If there is no existing file the switch is ignored.
    Last edited by jagabo; 27th Oct 2024 at 10:37.
    Quote Quote  
  16. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Originally Posted by pandy View Post
    If 256GiB is your problem then i need to ask what kind of length and bitrate are expected to be dealt... Personally if i need to upload something on YT then i prefer encoding speed instead file size (so i prefer preset rather fast/faster than medium/slow) - also i would probably avoid B frames at all (i use only I and P type - my observation leading me that there is less quantizer "pumping" visible in final render).
    Anywhere from minutes to hours depends on the material, For me quality is the priority, I would prefer to upload large file sizes because that doesn't bother me at all, No cap in data, upload speed is very high and I don't have to sit next to it to watch it uploading, The only limit is YT file size, hence encoding. One tape I'm uploading that initially exceeds YT file size limit, I was able to cut the size down using the FFV1 in vdub2 but it is only 41min, longer tapes will eventually go over.


    Originally Posted by Selur View Post
    Small side question: Does it make sense to upload 4:2:2 content to YouTube, afaik. YouTube always converts to 4:2:0?
    Unless we know how YT algorithm handles both 4:2:2 and 4:2:0 as inputs, Sure everything is going to be mushed down, that's the whole reason. to keep the losses at minimum. The same way for resolution, did you think I want to upscale SD from VHS to 4K?


    Originally Posted by jagabo View Post
    Also, there's a rec.601 vs rec.709 color difference between the two youtube videos in post #12. The command line I gave explicitly flagged the video as rec.709. I assumed that because it was upscaled to 4K, though it's not flagged as such in the earlier huffyuv AVI.
    I do convert that to rec.709 in vdub output, Haven't used your script yet for an actual long file, Will try it later.
    Quote Quote  
  17. Originally Posted by dellsam34 View Post
    Originally Posted by pandy View Post
    If 256GiB is your problem then i need to ask what kind of length and bitrate are expected to be dealt... Personally if i need to upload something on YT then i prefer encoding speed instead file size (so i prefer preset rather fast/faster than medium/slow) - also i would probably avoid B frames at all (i use only I and P type - my observation leading me that there is less quantizer "pumping" visible in final render).
    Anywhere from minutes to hours depends on the material, For me quality is the priority, I would prefer to upload large file sizes because that doesn't bother me at all, No cap in data, upload speed is very high and I don't have to sit next to it to watch it uploading, The only limit is YT file size, hence encoding. One tape I'm uploading that initially exceeds YT file size limit, I was able to cut the size down using the FFV1 in vdub2 but it is only 41min, longer tapes will eventually go over.
    Then if possible i would go with fixed QP (something reasonable like 8..16) and only I and P frames thats all - as Google will recompress this anyway then i would not bother trying to squeeze bitrate within refined preset - especially if you claim your upload speed is high (IMHO it can be justified to reduce filesize as much as possible even at a cost of longer encoding if upload speed will be slow but if your upload is fast then why bother to perform computationally expensive encoding) - quality is outcome of available bitrate and this is deciding factor - more sophisticated encoding tools are focusing on bitrate reduction even at a quality cost.
    Quote Quote  
  18. Yes, if you don't need a lot of compression you can use a faster preset, a lower quantizer, and no b-frames.

    Something like:

    Code:
    ffmpeg -y -i %1 -pix_fmt yuv422p10le ^
        -c:v libx265 -preset veryfast -profile:v main422-10 -crf 8 -x265-params bframes=0 -colorspace bt709 ^
        -c:a copy "%~n1.x265.main422-10.mkv"
    The result was about 17.7 MB, compared to 5.5 MB for my earlier settings.
    Quote Quote  
  19. So math is simple 256GB means there is 2048 Gb available for file, this mean that let say file is 3600 seconds (1 hour) long then for 1 sec we have over 568Mb available so if your source HUFFYUV encoded was around 1400Mbps then H.265 need to compress source approx 2,5 times more efficient than HUFFYUV - let say HUFFYUV can provide 3 times compression so in overall HEVC need to be able compress source with factor 8 - this should be quite easy and it should provide quasi lossless compression. Of course this is quite simplistic estimation and for material longer than 1 hour compression must be more efficient but it should be not so difficult as in real life we expects compression factors at least one order higher than your case - probably 3 hour+ long source should be able to fit within 256GB limit.
    Quote Quote  
  20. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    All makes sense, Thank you guys.
    Quote Quote  
  21. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    This is the 138GB lossless version upload:

    https://youtu.be/YWZsX_EGOK4
    Quote Quote  
  22. So YT offers your video at best with 16.4Mbps - there is long way from 448Mbps in your source.
    Quote Quote  



Similar Threads

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