VideoHelp Forum
+ Reply to Thread
Page 3 of 4
FirstFirst 1 2 3 4 LastLast
Results 61 to 90 of 117
Thread
  1. 1) Find out what kind of jpegs you have as your source (ie are they subsampled to begin with? )

    You can use ffmpeg -i input.jpg or use something like jpegsnoop . Or if you don't know how , upload a single frame
    Quote Quote  
  2. Originally Posted by Track View Post
    How do I create a "Truly" lossless H.264?
    Earlier post edited several times...
    Quote Quote  
  3. Also , there are better lossless (compression wise) codecs than x264 . Are your only requirements a) single video b) lossless c) compression efficiency ? or do you have other requirements like compatibility (or is it only going to be played on a computer) ?

    There are other selection criteria for choosing various lossless codecs (compatibility with various software and platforms (e.g. win/mac/linux), compression , encoding speed, decoding speed & latency) . For example very highly compressed videos won't necessarily play at high frame rates (suttering), and are meant for archival purposes, not realtime playback (might not be a big issue with timelapse, but for other things)
    Quote Quote  
  4. I've been able to get Handbrake to produce lossless x264 when starting with a YUV 4:2:0 source (the above Lagarith.avi file converted to Lagarith 4:2:0). After loading the video into Handbrake select the Normal preset. Change the following settings: Container=MKV, Constant Framerate, RF=0, profile=Auto, level=Auto. If you want something other than the default GOP size put it in the Extra Options box. For example keyint=1 for all i-frames.

    The resulting MKV file appears to contain all 10 frames but when I open it with ffVideoSource() I only get the first frame. I have to remux it with MMG to get all 10 frames with ffVideoSource(). After that, comparing the x264 video to the Lagarith YV12 source shows every frame is an exact copy of the source.

    The lagarith YV12 source was 62.6 MB. The lossless x264 video was 58.1 MB (Handbrake chose a keyint of 50, but since the clip is only 10 frames long there is 1 i-frame followed by 9 p-frames).
    Quote Quote  
  5. Originally Posted by poisondeathray View Post
    Or if you don't know how , upload a single frame
    Done.

    Originally Posted by jagabo View Post
    I've been able to get Handbrake to produce lossless x264 when starting with a YUV 4:2:0 source (the above Lagarith.avi file converted to Lagarith 4:2:0). After loading the video into Handbrake select the Normal preset. Change the following settings: Container=MKV, Constant Framerate, RF=0, profile=Auto, level=Auto. If you want something other than the default GOP size put it in the Extra Options box. For example keyint=1 for all i-frames.

    The resulting MKV file appears to contain all 10 frames but when I open it with ffVideoSource() I only get the first frame. I have to remux it with MMG to get all 10 frames with ffVideoSource(). After that, comparing the x264 video to the Lagarith YV12 source shows every frame is an exact copy of the source.

    The lagarith YV12 source was 62.6 MB. The lossless x264 video was 58.1 MB (Handbrake chose a keyint of 50, but since the clip is only 10 frames long there is 1 i-frame followed by 9 p-frames).
    So, I was correct about the 181Mbps file not being optimal quality, right?

    The resulting file is 249Mbps.

    Just to summarize.. you're saying that this 249Mbps file is identical to the Lagarith encode in every way besides I-frame amount and whatever color resampling had to occur?

    If so, would enabling all I-frames be of worth to me?

    And most importantly, is there a way to create this video without the changing of color from YUV to RGB or whatnot?

    EDIT: I just thought of something else.. if I don't enable full I-frames then does that limit me from changing the frame rate later on? We are talking about a time-lapse here and this ability is cruicial. I mean, if only one out of every 50 frames is a "real" frame, then I suppose the frame rate is final, isn't it?

    EDIT2: I only will likely need to crop the video to conform to 16:10 or 16:9 - is there a way I can do that without losing quality in a further encode or should I just batch crop the photos before creating the video?

    EDIT3: I'm trying to create a new time-lapse with Lagarith and there is an option for forcing keyframes.. I thought Lagarith had full key/I-frames..? There is also a "Null Frames" option.. how does that fit into everything?
    Image Attached Thumbnails Click image for larger version

Name:	IMG_4432.JPG
Views:	385
Size:	9.20 MB
ID:	19924  

    Last edited by Track; 6th Sep 2013 at 03:55.
    Quote Quote  
  6. So, I tried all 3 options:

    1.) Lagarith, no null frames, YUY2. Result is 1.8GB/537Mbps. This file cannot be played.
    2.) Jagabo's suggestion - Profile = Auto, CRF = 0. Result is 1.45GB/438Mbps. This file cannot be played.
    3.) My original encode - Profile = Main, Bitrate = 1Gbps. Result is 600MB/179Mbps. This file can be played.
    4.) Profile = Main, CRF = 0. Result is 60MB/19Mbps. This file can be played.


    There is no quality difference between the first two that I can see, like Jagabo said. There is a very slight difference in the third one and obviously the fourth looks like shit.
    Image Attached Thumbnails Click image for larger version

Name:	Comparison.png
Views:	689
Size:	247.5 KB
ID:	19925  

    Quote Quote  
  7. There are no standalone players that can play lossless x264.

    Is all that camera shake from the building swaying?
    Quote Quote  
  8. Originally Posted by jagabo View Post
    There are no standalone players that can play lossless x264.

    Is all that camera shake from the building swaying?
    Well, it can play 179Mbps pretty easily, but 438Mbps is impossible? Doesn't seem right.

    Camera shake..?
    Quote Quote  
  9. How do I create a "Truly" lossless H.264?
    you use "High 422" instead of "High" and set the input and output color space options to i422.
    (for 4:4:4 content you need to use "High 444" and set the input and output color space options to i444)
    + you need to use a decoder which supports High422/444 during playback
    note: No clue if and how this is possible if Handbrake is used. (never used Handbrake and don't plan to)
    Quote Quote  
  10. Originally Posted by Track View Post
    Originally Posted by jagabo View Post
    There are no standalone players that can play lossless x264.

    Is all that camera shake from the building swaying?
    Well, it can play 179Mbps pretty easily, but 438Mbps is impossible? Doesn't seem right.
    Main profile did not give you a lossless file. No standalone player can play h264 4:2:2 either. And x264 doens't support lossless with profile=high422:

    Code:
     x264 [error]: high422 profile doesn't support lossless
    Originally Posted by Track View Post
    Camera shake..?
    Your camera is shaking. It moves with every frame.
    Last edited by jagabo; 6th Sep 2013 at 08:28.
    Quote Quote  
  11. Originally Posted by jagabo View Post
    Main profile did not give you a lossless file. No standalone player can play h264 4:2:2 either. And x264 doens't support lossless with profile=high422:
    By "cannot be played" I mean the CPU utilization is 100% on my 5Ghz 2600k.

    Not sure what the color has to do with this.

    Originally Posted by jagabo View Post
    Your camera is shaking. It moves with every frame.
    This particular time-lapse was shot at the Helmsley building on 59th st. which has vertical slider windows, which required a boom to extend the camera all the way out of the windows. This also allowed me to capture 180-degree Gigapixels.

    I suppose it must have been windy on the 41st floor. Nothing a little post-processing can't fix.
    Quote Quote  
  12. And x264 doens't support lossless with profile=high422:
    What resolution does you content have?
    High 422 and High 444 normally shouldn't be a problem with your cpu,...
    Quote Quote  
  13. Originally Posted by Selur View Post
    And x264 doens't support lossless with profile=high422:
    What resolution does you content have?
    High 422 and High 444 normally shouldn't be a problem with your cpu,...
    I tried the OP's 3840x2560 Lagarith YUV 4:2:2 video. High444 encodes without a problem. But if I specify High422 x264 gives the error message I quoted at CRF=0.
    Quote Quote  
  14. yup, you are right only 444 is supported for lossless
    (I even made, a while ago, sure in Hybrid that lossless can only be used High444 or Unrestricted is selected as avc profile )
    Quote Quote  
  15. Originally Posted by Track View Post
    Originally Posted by jagabo View Post
    Main profile did not give you a lossless file. No standalone player can play h264 4:2:2 either. And x264 doens't support lossless with profile=high422:
    By "cannot be played" I mean the CPU utilization is 100% on my 5Ghz 2600k.
    Higher bitrates require more CPU power.
    Quote Quote  
  16. The jpegs are yuvj422p . ie they are already subsampled , full range 4:2:2

    libx264 does support lossless 4:2:2 , at least the CLI version I'm using from komisar
    http://komisar.gin.by/

    ffmpeg can decode jpegs as YUV (same as original), but cannot pipe full range YUV . Fortunately some x264 builds have ffms and lavf built in for decoding

    Code:
    x264 --demuxer lavf --fps 30000/1001 --crf 0 --input-range pc --range pc --input-csp i422 --output-csp i422 -o x264cli_lavf_422.mkv "IMG_4432.JPG"
    To get an image sequence, you use wildcard syntax, eg.

    img_0000.jpg
    img_0001.jpg
    img_0002.jpg
    .
    .
    .


    would be "img_%04d.jpg"


    You will still have the playback problems, and in addition , the levels problems I mentioned earlier (this will be full range YUV so the contrast will look different unless your player is configured properly to decode full range YUV to RGB for display)

    The lagarith route you are taking decodes to RGB, and back to limited range (16-235) 4:2:2 YUV. So you incur the colorspace losses there (but really, they are minimal) . Decoding with lavf directly and feeding to x264 will preserve everything (4:2:2 YUV 0-255 full range, same as the original jpegs), but you must configure your playback software properly
    Quote Quote  
  17. Originally Posted by poisondeathray View Post
    libx264 does support lossless 4:2:2 , at least the CLI version I'm using from komisar
    http://komisar.gin.by/
    I just tried the x86 build from there and I got the same error message.
    Last edited by jagabo; 6th Sep 2013 at 10:12.
    Quote Quote  
  18. high444 (or unrestricted) + i422 lossless should work
    high422 + i422 lossless should not
    as far as I remember,...
    Quote Quote  
  19. Originally Posted by jagabo View Post
    Originally Posted by poisondeathray View Post
    libx264 does support lossless 4:2:2 , at least the CLI version I'm using from komisar
    http://komisar.gin.by/
    I just tried the x86 build from there and I got the same error message.
    I used the kmod version, not the "clear" vanilla version
    Quote Quote  
  20. Originally Posted by poisondeathray View Post
    I used the kmod version, not the "clear" vanilla version
    Yes, that's the one I used (renamed x264.exe and replaced the older version I was using). A 422 AviSynth script dropped onto this batch file:

    Code:
    x264.exe --preset=slow --crf=0 --sar=1:1 --profile=high422 --output %1.mkv %1
    If I change it to high444 it works. If I specify anything other than crf=0 it works. But crf=0 and profile=high422 gives the error message. Do I need something more on the command line?
    Quote Quote  
  21. Originally Posted by jagabo View Post
    Originally Posted by poisondeathray View Post
    I used the kmod version, not the "clear" vanilla version
    Yes, that's the one I used (renamed x264.exe and replaced the older version I was using). A 422 AviSynth script dropped onto this batch file:

    Code:
    x264.exe --preset=slow --crf=0 --sar=1:1 --profile=high422 --output %1.mkv %1
    If I change it to high444 it works. If I specify anything other than crf=0 it works. But crf=0 and profile=high422 gives the error message. Do I need something more on the command line?

    I used jpeg as input directly and --demuxer lavf in that example, since it was relevant to the op's case

    use --input-csp and --output-csp as in the example above with high444, you don't have to set the profile (you can let it automatically pick). If you set profile manually, you must use high444, otherwise lossless isn't supported . Then you use --input-csp and --output-csp for specifying the chroma subsampling

    See the documentation

    - high422:
    No lossless.
    Support for bit depth 8-10.
    Support for 4:2:0/4:2:2 chroma subsampling.

    - high444:
    Support for bit depth 8-10.
    Support for 4:2:0/4:2:2/4:4:4 chroma subsampling.
    Quote Quote  
  22. BTW, there is no way in avisynth to decode jpeg's as full range YUV, except with FFImageSource(), but it doesn't support sequences, only stills . All other decoders will output RGB AFAIK
    Quote Quote  
  23. You guys are going over my head with this YUV color depth stuff..

    Am I understanding that I cannot get a fully lossless (color depth included) encode out of Handbrake?

    Also, if someone could answer my questions regarding I-frames and null frames in this post:

    https://forum.videohelp.com/threads/358544-Optimal-quality?p=2265312&viewfull=1#post2265312
    Quote Quote  
  24. Am I understanding that I cannot get a fully lossless (color depth included) encode out of Handbrake?
    At least https://trac.handbrake.fr/wiki/CLIGuide doesn't show an option to set input&output color space. So either Handbrake will keep input = output color space (probably not) or simply convert everything to 420 (probably).
    Quote Quote  
  25. If so, would enabling all I-frames be of worth to me?
    -> you could use the new AVC-Intra compatibility if you use x264 via command line.
    In general: Intra only coding is only useful (a good idea) if you:
    a. do not care about the size
    b. do want the output to be an intermediate for later editing

    if I don't enable full I-frames then does that limit me from changing the frame rate later on?
    Nope, frame rate is only a flag in the container.

    I only will likely need to crop the video to conform to 16:10 or 16:9 - is there a way I can do that without losing quality in a further encode or should I just batch crop the photos before creating the video?
    Reencoding into a lossy format -> you will lose quality (unless you reencode into a lossless format)

    There is also a "Null Frames" option.. how does that fit into everything?
    NUL Frame = not coded frames, meaning: if two (adjacent) frames are identical only one frame will be coded and the other will be a null frame = a frame that is 0 and only refers to the other frame. This way the raw stream would only contain the image once, but the decoder (assuming it supports nul frames) will output two identical frames.
    Quote Quote  
  26. Okay, so:

    1.) I am almost certain that Handbrake converts to 420. This is why I started using Xvid4PSP because it allowed me to keep the color depth of the 1080p video files I captured while Handbrake did not. In this case, is the file ever going to be lossless if Handbrake converts the color depth? If not, what do I do?

    2.) In regards to Null frames, if only one frame is encoded, how do I change the frame rate? Wouldn't there be physically fewer frames in the encode?

    3.) My main point is to be able to extract each individual frame from the video.. so, how does this work in regards to I-frames and Null frames?
    Quote Quote  
  27. Originally Posted by Track View Post
    In regards to Null frames, if only one frame is encoded, how do I change the frame rate? Wouldn't there be physically fewer frames in the encode?
    Null frames aren't literally nothing. They are frames that contain no data except to indicate the last frame should be repeated. So a video with null frames has just as many frames as the same video without null frames.
    Quote Quote  
  28. Originally Posted by jagabo View Post
    Originally Posted by Track View Post
    In regards to Null frames, if only one frame is encoded, how do I change the frame rate? Wouldn't there be physically fewer frames in the encode?
    Null frames aren't literally nothing. They are frames that contain no data except to indicate the last frame should be repeated. So a video with null frames has just as many frames as the same video without null frames.
    Right, but some of them would just be blank and there would only be a small amount of actual "real" frames in the mix.

    Also, why aren't you responding to my questions about color depth? You seem to know the most and you're the one who brought up the issue of an encode not being completely lossless without ruling out a color conversion.
    Quote Quote  
  29. Originally Posted by Track View Post
    Originally Posted by jagabo View Post
    Originally Posted by Track View Post
    In regards to Null frames, if only one frame is encoded, how do I change the frame rate? Wouldn't there be physically fewer frames in the encode?
    Null frames aren't literally nothing. They are frames that contain no data except to indicate the last frame should be repeated. So a video with null frames has just as many frames as the same video without null frames.
    Right, but some of them would just be blank and there would only be a small amount of actual "real" frames in the mix.
    The decoder understands that it should return a copy of the previous frame when it encounters a null frame. So the output of the decoder has just as many frames whether null frames were used during encoding or not.

    Originally Posted by Track View Post
    Also, why aren't you responding to my questions about color depth? You seem to know the most and you're the one who brought up the issue of an encode not being completely lossless without ruling out a color conversion.
    I don't work here. I'm not paid to read your questions or respond to them. Maybe I didn't notice the question. Maybe I thought some other reply was sufficient. Maybe I forgot. Maybe I didn't know the answer. Maybe I just didn't feel like answering. Maybe if you ask the question again I'll reply. Maybe not.
    Last edited by jagabo; 7th Sep 2013 at 08:21.
    Quote Quote  
  30. Technically, neither handbrake or xvid4psp options will be "lossless", because xvid4psp uses avisynth in the backend (jpegs it will be decoded to RGB first). Also the conversion for the output YUV will be limited range 16-235 YUV , not full range 0-255 YUV like the original jpegs

    Why not just keep the original jpegs , and a different lossy, lower resolution version for playback ? Even you said you couldn't tell the difference and you were actually weren't using lossless files . And your "lossless" file wasn't even CRF0 and it was subsampled farther

    You will have playback difficulty with the lossless intermediates at full resolution, levels problems if you use full range YUV and don't configure the player properly (Most players don't expect full range YUV, they expect "normal range" levels) . The only types of video that "play out of the box" properly on all setups , even hardware players like media boxes without hassle are 8bit 4:2:0, lossy encoding.
    Quote Quote  



Similar Threads

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