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
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 61 to 90 of 117
Thread
-
-
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) -
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). -
Done.
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?Last edited by Track; 6th Sep 2013 at 03:55.
-
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. -
There are no standalone players that can play lossless x264.
Is all that camera shake from the building swaying? -
-
How do I create a "Truly" lossless H.264?
(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) -
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
Last edited by jagabo; 6th Sep 2013 at 08:28.
-
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.
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. -
And x264 doens't support lossless with profile=high422:
High 422 and High 444 normally shouldn't be a problem with your cpu,... -
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"
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 -
Last edited by jagabo; 6th Sep 2013 at 10:12.
-
high444 (or unrestricted) + i422 lossless should work
high422 + i422 lossless should not
as far as I remember,... -
-
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
-
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.
-
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 -
Am I understanding that I cannot get a fully lossless (color depth included) encode out of Handbrake?
-
If so, would enabling all I-frames be of worth to me?
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?
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?
There is also a "Null Frames" option.. how does that fit into everything? -
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? -
-
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. -
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.
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.
-
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.
Similar Threads
-
Need help getting optimal quality for DVD-5
By BlackThought in forum Video ConversionReplies: 8Last Post: 4th Apr 2012, 23:37 -
Optimal settings for conversion
By airwolfUK in forum Video ConversionReplies: 1Last Post: 17th Feb 2011, 15:08 -
Is there a better way to get optimal quality converting from .flv to DV?
By brassplyer in forum Video ConversionReplies: 7Last Post: 5th Jan 2011, 20:26 -
Optimal mpeg2avi conversion.
By mery in forum Video ConversionReplies: 1Last Post: 16th Dec 2010, 19:50 -
Best h.264 setting for optimal size/quality with handbrake.
By frickfrock99 in forum Newbie / General discussionsReplies: 4Last Post: 1st Oct 2010, 03:09