View Full Version : uncropMKV - get your video files to AVCHD/BD compliant resolution/level/ref frames
deank
25th March 2009, 15:04
Some time ago I created a small tool to make mkv files compliant with 720x480, 1280x720 and 1920x1080 AVCHD/BD requirements. I also use it when I'm stuck with mkv videos with too high frame reference count (x264 ref) or level higher than 4.1.
http://multiavchd.deanbg.com/uncropMKV.jpg
I first posted this in multiAVCHD (http://forum.doom9.org/showthread.php?t=143744) thread, but I'd like to keep it separated. It's major function is to re-crop your input file, allowing you to change it before encoding.
uncropMKV will try to make your VIDEO compliant to AVCHD/BD standards, but not the audio. Please check AVCHD/BluRay standards before complaining about anything.
Download (7z self-extractable exe):
----------------------------------------
Full download: uncropMKV (http://multiforum.deanbg.com)
If you already have multiAVCHD (http://forum.doom9.org/showthread.php?t=143744) you can download the .exe only and put it in your multiAVCHD folder. Make sure you have the latest full version and check if you have mkvmerge.exe in your tools folder. .EXE ONLY is suitable for multiAVCHD users who downloaded the FULL MULTIAVCHD package after 26-03-2009.
----------------------------------------
You'll also have to have:
* AviSynth (http://sourceforge.net/project/downloading.php?group_id=57023&use_mirror=kent&filename=Avisynth_258.exe&6791458) installed and
* DirectShow decoder (ffdshow (http://sourceforge.net/project/showfiles.php?group_id=173941) - direct link (http://sourceforge.net/project/showfiles.php?group_id=173941&package_id=199421&release_id=469925))
* DirectShow splitter (Haali (http://haali.cs.msu.ru/mkv/MatroskaSplitter.exe)).
----------------------------------------
To start processing you need to add at least one file to the queue. (load file/change options/click queue button/click start button).
uncropMKV allows you to do:
* various resizing and uncropping and pre-cropping
* framerate change, frame reference count change, bframes setting
* sharpen/blur, h.264 level change, etc...
* select/deselect streams that will be used/removed in the final -uncropped.mkv.
* Max value for ref. frames is automatically calculated according to output resolution. You can safely use the largest number.
* Uncropped resolution is automatically calculated and selected
* Bitrate is automatically set to the original bitrate from your input file
* The program works in 16:9 aspect ratio mode and uses square pixel (SAR 1:1), but...
* Predefined re-size options allow creating anamorphic videos, for original videos with widths of 1920, 1440 or 1280 pixels.
* Be advised that your final video will have the resolution set in uncrop dropdown box UNLESS resize and uncrop are in conflict.
*** For example if the resize box shows 1920x1088 - uncrop will show 1920x1080 but your video will still be 1920x1088.
*** You need to use CROP T/B to cut 4 pixels from both sides to make it 1088-4-4=1080 (1920x1080) and use the last items in resize box with fixed 1920x1080 sizes. It is a rare case for such thing to happen, but still it is good to be known.
For example:
Input video: 1920x816
Resize option: 720x364
Uncropping to: 720x480 (4:3 AR)
and you'll get anamorphic 16:9 aspect ratio with really nice quality.
I just tested it on my Playstation3 after running the mkv
through multiAVCHD to get it to AVCHD/BD structure.
The program won't demux the streams from the original file, but will only use the video (directshow) and those you decided to keep on the fly.
Your output folder will contain the new movie-uncropped.mkv + movie.264. You can delete the latest if you don't need it for further processing.
You can also use it:
* ...to create overscan or/and
* ...with videos which don't need re-cropping, but only change of Level/Bitrate/RefFrames.
* ...with popBD (http://forum.doom9.org/showthread.php?t=145482) or multiAVCHD (http://forum.doom9.org/showthread.php?t=143744) to create AVCHD or Bluray Discs
http://multiavchd.deanbg.com/uncropMKV_4x.jpg
If you like the application, support the author.
Dean Kasabow
Aai em ron
25th March 2009, 16:57
Programm works perfectly and is extremely fast.
I tried an 9 GB 1080p movie and it took me only 3 hours to uncrop from 1920*800 to 1920*1080.
And the result was perfect.
So this is what I want to say: :thanks:
jtheripper
25th March 2009, 20:10
I tried it on a 720P MKV and unfortunately the uncropped version's audio was out of sync from the beginning
deank
25th March 2009, 20:13
If you had an older version it is possible. I fixed the issue this morning. Re-download the .exe only and try with a shorter clip or use "trim end"... And have your pre/post processing filters in directshow filter (ffdshow) disabled.
I did few encodes and I have no audio synch problems...
~bT~
26th March 2009, 03:09
thanks deank! another simple lil gem!
gaganspidey
26th March 2009, 09:09
Hey thanks for your contributions.
I wish there would be a way of adding black borders without re-encoding, unfortunately its not possible I guess.
drpaulng
26th March 2009, 09:34
Does it accept ts or m2ts as input?
deank
26th March 2009, 12:36
No, but you can demux the m2ts/ts file with tsmuxer to h.264+audio and merge them into mkv with mkvmerge and then use the output with uncropMKV... it takes minutes only.
mmace
26th March 2009, 13:24
brilliant, cheers
deank
26th March 2009, 15:09
A small example of application...
The last 2 mkv files I tried with:
They had Level 5.1 and high ref count uncompatible with BD. Both files were 1920x1080, so no need for uncropping.
I left resize/uncrop to 1920x1080, set ref.frames to 4 and bframes to 4, used the original bitrate ~12MBit and after about 3hrs I got the job done.
Their input size was about 4.4GiB each but if muxed to m2ts they won't fit DVD5 media.
After processing and muxing to m2ts the final size for DVD5 became 4.3GiB, which perfectly fit the media and played great in my PS3.
And here is how Playstation3 performs with the bitrate from AVCHD DVD+RW disc: :)
http://multiavchd.deanbg.com/avc33mPS3.JPG
I think it is the x264 encoder that performs brilliant in its last builds and creates such outstanding quality, being much faster than before.
nwg
26th March 2009, 15:47
Nice work. I wonder if it would be possible to add a audio aac to ac3 option. I have some mkv's that use aac audio and get just .264 video as the result.
deank
26th March 2009, 15:51
If you can send me a small sample to try with... It would need eac3to I guess... and an .ini file....
nwg
26th March 2009, 16:13
If you can send me a small sample to try with... It would need eac3to I guess... and an .ini file....
They were just quicktime mov trailers converted to mkv using mkvmerge. I then usually put them through ripbot to make them into a resized m2ts with ac3 so multiavchd can read them. If uncropmkv could read them without ripbot then it would save a lot of time and another step.
I get them from http://www.davestrailerpage.co.uk/.
deank
26th March 2009, 16:23
I just found one mp4 on my PSP and used mkvmerge to make it mkv and now i'm trying with it ;)
What happens when you use the mkv after mkvmerge? Doesn't it recognize the aac audio, because with my file it shows and is muxed in the final -uncropped.mkv as aac. And eac3to won't encode aac to ac3 without nero directshow filter (which I don't have)... duh...
nwg
26th March 2009, 20:42
It does detect the acc audio but it I don't get a uncropped mkv. I get the orignal mkv and the new .264 file.
herrde
26th March 2009, 22:00
Hi deank,
another brilliant program - just one issue and one question -
I just did an uncrop of a 150 MB MKV. But when I try to load the now uncropped MKV into uncropMKV OR if I try to play it back using VLC Player, it first says "wait..." (as usual), but then the preview screen turns black and I receive the message:
"CAVIStreamSynth: System exception - Access Violation at 0x0, reading from 0x0"
The sound plays back fine, by the way. I ran uncropMKV in Administrator mode under Vista 32bit.
Also, I noticed that it put out a *.264 file in the target directory which is 1,8 MB in size.
What can I do? I am using your latest uncropMKV.exe (the one with today's date and "11:46" time stamp). AviSynth 2.5 is installed as is ffdshow.
And the other question - uncropMKV really works quite fast - does it perform a full re-encoding of the MKV (thus lowering the picture quality like every recode does) or does it really just ADD the black borders without actually affecting the movie quality?
Thanks for your help!
All the best,
Gero
deank
26th March 2009, 22:44
Yes, it reencodes it. If you get a small .264 file it means something has gone wrong. It can be a badly cut mkv file you have or something else. I tried over 50 mkv files and they all work fine.
ACrowley
27th March 2009, 13:31
"CAVIStreamSynth: System exception - Access Violation at 0x0, reading from 0x0"
I had this Error with Avisynth too in Year 2007. Install the latest Avsiynth (beta). That was the fix for me. I never get this Error again
deank
28th March 2009, 02:34
Another seven (static) resolutions are added at the end of the "Resize" drop-down:
640x480
720x480
720x576
960x720
1280x720
1440x1080
1920x1080
They should allow you to resize input video to full-frame or to a resolution that will keep original AR, no matter the uncrop. These are useful for weird resolutions and really make sense. I hope you'll find them useful.
Dean
p.s. Just re-download the .exe. The complete package is also updated.
jj420
28th March 2009, 14:06
hi Deank, I think all your programs work great...popBD, multiAVCHD, and you've finally shown me uncropMKV to fix those NC resolution mkv's.
I've run uncropMKV a couple of times now on 2 different files and both times i'm only seeing the x264 file and NOT the uncropped.mkv file. What am I doing wrong?
here's what i'm running: uncropMKV ver. 0.2, Avisynth 2.58 and FFPshow
i'm totally confused now...
deank
28th March 2009, 14:12
Please check if you have:
mkvmerge.exe
in your tools folder.
You either have to download the LATEST FULL multiAVCHD (14MB) or the full uncropMKV_0.2.exe. They both have the tools needed.
I think that if you have only the 264 file it is because mkvmerge is missing.
Don't delete these 264 files. Just use tsmuxer to demux the audio from them.. put them in a folder and name your files
movie.264
movie.ac3 (if your audio is ac3)
and multiavhcd will make a compilation.
Or you can add the 264+audio with mkvmerge to get your MKV.
Or just download the packages, check for tools\mkvmerge.exe and try again. Post back if it works for you.
If at the end of the log you see:
mkvmerge: .........
and then in 1 second program ends - it is mkvmerge problem for sure.
You can also test using "TRIM END" and cut just 1-2mins of your input file - just to see if it will work - no need to wait hours to find it doesn't work :)
jj420
28th March 2009, 14:46
thanks Dean i'll try that...
just to be clear, to do a small test i can just click on the "trim end" button to get it going?
i'll keep you posted
deank
28th March 2009, 14:50
Yes, move the slider to the left and click trim-end then start.
dracore
28th March 2009, 15:17
can this work in batch for over night work!
deank
28th March 2009, 15:23
No, but it can be added... probably as command-line utility... I will think of it.
jj420
28th March 2009, 15:46
it worked Dean, thanks very much!! now I can make compliant resolution files!!
I appreciate it! keep up the good work, you will be seeing a donation real soon... :)
deank
28th March 2009, 15:56
I'm glad to have another happy user of my tools :)
rhayman
28th March 2009, 18:29
Thankyou very much for this program. Extremely fast. I encoded a 720p movie in about 2 hours on a quad core.
Wierd thing is that encoding the same movie using a 2-pass encode on megui (blu-ray profile) took 8 hours.
Is there any way of doing a 2-pass encode using this program?
deank
28th March 2009, 18:34
Take a look at the quality and if you think there is need for 2 pass then use megui. I'd rather keep it 1 pass only.
Aai em ron
28th March 2009, 23:50
One little question: Wat are the best x264 settings for Ref. Frames and B.Frames. Their default settings are both 3.
Is that average quality? When I leave them both to 3, the quality of the uncropped movie is excellent. Can I make that even better with other x264 settings? I'm just wundering.
Thanks again for your great tools.
Ron.
deank
29th March 2009, 00:06
I'm using ref.4 and b-frames:4 for 1920x1080. The larger b-frame value is the better compression but quality may degrade. I'd suggest you use these 3/3 values or max. 4/4.
I've put settings that should provide real nice quality with less encoding time. Also I tried to make the output uncropped.mkv to be in size almost as the original. You can experiment with different settings in shorter clips and see the difference.
Aai em ron
29th March 2009, 09:53
I'm using ref.4 and b-frames:4 for 1920x1080. The larger b-frame value is the better compression but quality may degrade. I'd suggest you use these 3/3 values or max. 4/4.
I've put settings that should provide real nice quality with less encoding time. Also I tried to make the output uncropped.mkv to be in size almost as the original. You can experiment with different settings in shorter clips and see the difference.
So, you say, the higher the number you use, the higher the compression, butt you get less quality, is that right?
So, for example when I use 1/1 , I get a big file with perfect quality? Or can you hardly see the difference?
deank
29th March 2009, 10:47
I'd suggest you take a look here (http://mewiki.project357.com/wiki/X264_Settings). There are tons of options that have impact on quality/speed/compression.
Aai em ron
29th March 2009, 12:03
I'd suggest you take a look here (http://mewiki.project357.com/wiki/X264_Settings). There are tons of options that have impact on quality/speed/compression.
Oke,thanks.:)
Selur
29th March 2009, 22:06
@deank: since you write compliant with 720x480, 1280x720 and 1920x1080 AVCHD/BD requirements. I wonder, what vbv values do you use in your application?
deank
29th March 2009, 22:18
Compliant ones. I use 30/30 and tested on the slower DVD-RW with planet earth clip which shows momentum 50MBps (PS3 playback info) and there is no stutterning with 1920x1080@24fps w/ 448kbps ac3 with x264 enc bitrate @ 12Mbps.
herrde
30th March 2009, 12:33
I had this Error with Avisynth too in Year 2007. Install the latest Avsiynth (beta). That was the fix for me. I never get this Error again
Thanks for the tip, that did it!
Another thing that I noticed - though the resulting uncropped MKV files now seem to be perfect, I still get a large *.264 file next to the uncropped MKV... I suppose this is only the re-encoded videostream and can thus be safely deleted, right?
Thanks again,
Gero
deank
30th March 2009, 12:36
Yes, if you read the first post of this thread you will notice:
The program won't demux the streams from the original file, but will only use the video (directshow) and those you decided to keep on the fly.
Your output folder will contain the new movie-uncropped.mkv + movie.264. You can delete the latest if you don't need it for further processing.
deank
30th March 2009, 13:21
@deank: since you write compliant with 720x480, 1280x720 and 1920x1080 AVCHD/BD requirements. I wonder, what vbv values do you use in your application?
For bitrates and GOP shorter or eq. to one second (progressive video) for 1920x1080 and GOP of 24, for fps 23.976 max is 48mbps (Level 4.1), and for fps 24 it is 24mbps (Level 4.0).
Same is for 1280x720 with GOPs of 60 (fps 59.94) and 50 (fps 23.976/24).
For larger GOP as 48 or 120 (interlaced) max is 18mbps.
Not that I use all this to set proper max bitrate/buffer, but I think maxbuffer could be safely set to 30000 for all level 4.1 progressive sources.
deank
30th March 2009, 17:16
I updated the .exe - fixed drop-down with Ref. frames, sometimes showing values greater than 16 on lower resolutions, which is not correct.
Also tested to encode 1920x1080@23.976 with 4 ref. frames and 6 b-frames and PS3 plays it without problems.
***
edit:
I added another resize option: 540x480
If your source is 4:3 (and your player won't respect it, but stretches it to 16:9) you can choose between the following predefined resize options (at the bottom of the resize-drop-down list) to add black borders:
540x480 (for 480p)
960x720 (for 720p)
1440x1080 (for 1080p)
I performed some tests with 576i resolution to make my Playstation3 go into 576p and it worked. To use 576p mode in PS3, input file needs to be 720x576 interlaced @ 50fps. This is not included in the current version, but was a result of a test suggested by zoner.
At this point I can't find a way to make PS3 play 4:3 videos keeping their aspect ratio and not stretching it to 16:9.
T800
30th March 2009, 23:02
Can I use this program to cover existing video with black bars.
I have a 1.85:1 MKV open matte file that I would like to change to 2.35:1 OAR.
deank
30th March 2009, 23:02
Now you can queue files for all-at-once midnight :) processing.
Download the .exe. The full package is also updated to ver 0.3
Dean
edit:
@T800: Yes. It will reencode it, but will not crop it (to remove any existing bars).
tyee
31st March 2009, 05:52
Hi Dean
Everytime I hit "Trim End", my firewall (Online Armor with program guard running too) says the app is trying to access a few of my drives root directories and my source file is not on these drives. Is this normal?
deank
31st March 2009, 09:08
No... The only thing that happens after trim end is setting new last frame in the text box and doing a preview (using avisynth+x264) which creates 3 files.
Do you get the same warning when you move the slider and click the movie window?
Does your guard give more info? (not that I can change anything in the program, but still...)
deank
31st March 2009, 12:06
Another option to top/bottom CROP files before resizing/uncropping. You can experiment with positive/negative values to see what it does.
Positive crop values initiate RESIZE first and then CROP.
Negative crop values will make uncropMKV first to crop original video and then resize it.
tyee
31st March 2009, 15:15
Hi Dean
Yes, the same thing happens when I move the slider and click the movie window. The app is trying to access just my 3 drives that include 2 actual DVD drives plus my virtual drive letter. They are all empty of course.
update -- just noticed that it's the x264.exe that is trying to do this, not your app directly, maybe that gives you some clue? From your description above x264.exe is creating three files but why look at empty drives?
deank
31st March 2009, 15:19
I have no idea why this happens... It could be because of avisynth image-writer function that tries to extract a frame (as bitmap 00000.bmp) and saves it so it can be shown in the preview window. And the write-path for this image is the same as uncropMKV.exe, not outside it. I believe it is nothing to worry about. You can reinstall avisynth with the one in the first post.
Also - if you're using ffdshow - make sure you disable any post-processing/plugins. For example while generating the preview, ffdshow may try to look for subtitles and it scans drives for find a match.
This is the execution order: x264 -> avisynth -> ffdshow ... may be this is the problem.
jhmac
31st March 2009, 20:17
Tried out the v.03 version loaded up the queue with 6 movies let it work overnight and all I ended up with is the .264 files and no uncropped files. Hmmm wonder what happened. As far as I know they should have been in the same directory right?
Thanks
deank
31st March 2009, 20:24
It means that you don't have tools\mkvmerge.exe or it didn't do its work.
264 files are the most important ones so in case of (such) failure you can use them with mkvmerge gui, add your original audio and get your final file.
If you get only the .264 file it means that you 1st need to test and then rely on overnight processing. No refunding here.
Try again those unsuccessful files. Use "trim end" (while having slider moved to like 5% of your movie duration) and see what will happen.
Do you have full and latest uncropMKV package downloaded?
tyee
31st March 2009, 20:45
Hi Dean
Thanks for the tips, I try it when I get home. One other question. This app works with the typical MKV with lossy audio tracks, but can we get it working with Dolby TrueHD and DTS HD MA?
If we get eac3to to demux an actual BR disk to .mkv video and then one of the non lossy audio tracks to .trueHD, could we then use those in uncropMKV?
I know in that case (using a BR disk), that we wouldn't necessarily be cropping but it would be nice to use this app for both types of jobs;)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.