VideoHelp Forum




+ Reply to Thread
Results 1 to 21 of 21
  1. Hello! I am a newbie at video editing. I have Sony Vegas 11 and I'm trying to edit video files.

    I am a scientist and I have to score videos for a research project. The videos take up a lot of space on the hard drive and playing them can slow down the computers a great deal. Since what I need to view in the video only and always takes place in the very top quarter of the screen, is there a way to crop only the part of the video I need and save the remaining piece as a video file of the same quality? The aspect ratio of the new file would be non-traditional and I HOPE the encoded file would be significantly smaller because there is less video information within the file to encode given that all frames are now much smaller.

    What I need in the video is only recorded on the very top of the screen, let's say the top quarter of the video from top to bottom is what I want to save. I want to save 100% of the video from left to right.

    I would like to get rid of the 75% of the video that has nothing that I need and render the file without that lower part, but I don't want the new video file to have black where the missing part was. I don't want to simply "censor" the lower part of the video. I want it gone so that the new file is smaller and taking up less space on the hard drive. I want the aspect ratio now to have a very long width (original width) with a very short height (1/4 the original height).

    I have several videos encoded by multiple cameras. Some are .mp4 and some are .mts They are SD or HD, depending.
    I would also like to keep the same video quality of the source material.

    VLC player has a great feature where you can crop the video being played by specifying how many pixels to cut from the bottom of the screen, but it doesn't let you render the video the way it is cropped, it just alters the playback.

    In general, how can I achieve this? Preferably with Sony Vegas...

    I really appreciate your help in advance!
    Quote Quote  
  2. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Yes, cropping & resaving is a good idea to lessen the burden. However, then you have to think about WHAT format you are going to be saving it to.

    You don't want to go to the trouble of scaling your area of interest down to a smaller core area, and then destroy that area with heavy compression. Neither do you want to save the file uncompressed and have it remain a possible burden on your HDD subsystem (because then you could be trading your e.g. 50Mbps 1920x1080p60 AVC encode with a 800x320p60 4:2:2 uncompressed file at 500Mbps). So you need to smartly strike up a balance.

    Because most encoded video is made up of slices/macroblocks, it is conceivable that you could lop off a portion of a picture in the manner you specified, and have the extra data removed while just updating the headers regarding the remaining data in the original format, thereby avoiding loss/degradation. This is possible with JPEGs and a few apps have been specially created just for that purpose. However, AFAIK, there are no apps yet created that allow that for standard video compression formats.

    So you are left with re-encoding.

    Ahh, ok so I see you want full width & quarter height: I would suggest converting to a losslessly compressed (lagarith, huffyuv, utvideo, etc) or visually-nearly-lossless lossy compressed (prores, cineform, dnxhd) format. You should be able to do this in something like Vegas, but it is also fairly straightforward to do this with Virtualdub, AVIDemux, AVIUtil, AVISynth (with external encoder), or ffmpeg. And while a near-lossless DI might use up say ~150Mbps instead of common cam recordings of 12, 25 or 40Mbps, you are still easing the burden on your PC. Why?
    Because 150Mbps is still a fairly pedestrian demand on a hard drive, but much of the problem with editing your material is in the complexity of the codec and in the complexity of the GOP length/type. DI codecs are much less demanding when decoding and DI codecs are all Intra-frame-only codecs, so the editor app doesn't need to bother itself keeping track of those additional pre- and post- timeframe images.

    Scott
    Quote Quote  
  3. Thanks for your response!

    When I look at the rendering codec options available in my Vegas installation, none of them will allow for my custom aspect ratio, they are all preset to the common frame sizes like 1440x1080. You listed a bunch of codecs. Do you know if they will allow for a custom frame size? I downloaded one as a .dll file but I don't know where to put it on my computer so that Sony Vegas can discover it and I can select it when I "render as".

    I am wondering if this alternative would work. If I black out the lower 3/4 of the screen and render the result at the same quality of the original, will the file be smaller than the original given that BLACK is the only pixel color for 3/4 of the screen from the first frame to the last?

    I think one of my problems is a fundamental misunderstanding of how this all works. If I import a video into a new blank project, will the project take on the settings of the imported video? I don't know how to open a video and then edit it and save it according to the same settings as the original video. Theoretically, if I can do that and I black out 3/4 of the screen, the resulting file will be smaller because there is less information to encode, no?

    Given that I have videos of two types, I would like to know how to do it both ways (render with custom frame size, and render identically but with 3/4 black so that the file size is smaller).
    Quote Quote  
  4. Vegas's little brother 'Vegas Movie Studio' allows custom frame sizes. So I bet Vegas does also. In Movie Studio it's in the advanced options section when making a movie. There is a pull down menu that has one option called "custom frame size".
    Extraordinary claims require extraordinary evidence -Carl Sagan
    Quote Quote  
  5. @TreeTops: I have no trouble setting the Sony Vegas project with my custom frame size. The problem comes when I "render as" and there is no output format that will render in my custom frame size.
    Quote Quote  
  6. Odd, as I was referring to the 'Render As' (movie studio doesn't call it that anymore in latest version) In rendering a movie there is a pull down menu that allows custom frames but you must enter the numbers for your custom frame size.

    Give me that custom frame size again.
    Extraordinary claims require extraordinary evidence -Carl Sagan
    Quote Quote  
  7. Hmm. I think I see what you mean. When I open the "render as" dialog and select a codec, the button "Customize Template" becomes available. When I click on that, another window opens. In that window, most codecs only have a pull down menu for the frame size with common sizes. In some codecs, there is a custom frame size entry field for width and height, but they are usually greyed out......Hmmm I found one that is letting me keep original frame size or custom, both of which might work. I'll try and report back. This may help with this particular question. Thanks!
    Quote Quote  
  8. Banned
    Join Date
    Oct 2014
    Location
    Northern California
    Search PM
    1. Are those the original captures/videocamera sources or compressed copies?
    2. What is the codec and bitrate of the videos?
    Quote Quote  
  9. Before you continue, if your project requires truely identical quality (mathematically lossless for your scientific scoring or whatever you need this for), your file will likely become larger than the original even if is cropped to only 25% of the frame size (if the original files used video compression) . The reason is in video, it has to be decoded to uncompressed data before it is re-compressed (re-encoded) . So if BOTH reducing the filesize, and maintaining mathematically lossless quality is important, you can forget about it. However, if your project only needs "similar" quality, this should be possible with re-compressing the video with high compression codecs
    Quote Quote  
  10. @treetops: I found a way to encode with the custom frame size by selecting a codec that allows for it. The file size was half, but the quality was reduced too much. I think the trick will be to find a codec with which I can "render as" an output with custom frame size and similar quality video.

    @newpball:
    1. The original files that I am working with are straight from the cameras I am using.
    2. One camera (JVC Everio GZE306BUS) generates a .mts file AVCHD standard, MPEG-4 AVC/H.264. Looking at a file properties, it says video "total bitrate" of 17158kbps. For the image quality setting within the camera called "XP", the "average approximate is 17 Mbps which is consistent with the file properties.
    The second camera is SD. Records to .mp4 files. Samsung SMX-C20. Records with the H.264 Codec, but I don't have any files on this computer right now to check the bitrate.
    The third camera is HD. Samsung Hmx-m20 which also saves as .mp4 files and uses the H.264 codec.

    @poisondeathray:
    My project does not require mathematically identical video. I am scoring it based on what I see recorded on the video which was recorded in low red light, so I would like to preserve the image quality as much as possible so I can still make out what I am seeing. So, I am not against re-compressing the file and I want to in fact, have it compressed back to similar quality, only I am hoping that with either A. 3/4 the screen made black or B. using a custom frame size, the resulting re-compressed file will be smaller but the quality of the area with video that is not black is similar to the original quality.
    Quote Quote  
  11. If all you are doing is cropping, and want to export a smaller frame dimension - there are probably better, easier , faster ways to do this

    In vegas, set the project properties to the desired dimensions, or the "window" that you want. e.g. Lets say you have 1920x1080 sources and you just want the top 1/4 strip, or 1920x270. You would enter 1920x270 for the project settings dimensions. The problem is when you drop clips onto the timeline, vegas will auto scale them. You can get around this by using the event/pan crop tool. Right click the pane and select match output aspect. Then you have to adjust the y center position to the area you want (think of it as looking a bigger picture through a window, and you're physicaly moving the window up to look at the top part of the larger view) . The render settings would match the project settings, so 1920x270 .

    Since you have mixed clips, mixed dimensions, this is going to be more work.... Potentially a lot of headache depending on exactly what you are doing in vegas, what kind of edits, what type of project. If you want more help, you have to provide more details on the clips and project, type of edits etc...

    There are scripts and tools to prevent "auto scaling" in vegas, you can search for those if this is something you're going to be doing a lot of. (If you're just cropping I would actually use something else)
    Quote Quote  
  12. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    I would use ffmpeg for this, you can batch crop a whole folder of MTS clips with this script:
    Code:
    for %%a in ("*.MTS") do "C:\ffmpeg\ffmpeg" -i %%a -vf crop=1920:270:0:0 -c:v libx264 -level 40 -pix_fmt yuv420p -preset medium -crf 20 -threads 8 -c:a aac -strict experimental -ar 48000 -ab 256k -f mp4 "%%~na.mp4"
    
    pause
    1) copy the script and paste it into notepad, then save as Crop.bat
    2) edit the path to ffmpeg.exe and adjust parameters as needed, then save.
    3) drag the 1st clip into the batch file and it will process all clips of specified extension within that folder.

    Example:
    Image Attached Files
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  13. @poisondeathray
    I am only using Sony Vegas to modify the video files the way that I asked about to decrease their size without losing quality (making a large part of it black or cropping). I am not making a project and I am not combining the video files from different cameras. I am familiar with the pan/crop tool. Now that I know how to properly set the project frame size and pan/crop, etc., how do I go about rendering in a near lossless format once I've made changes to the project? I don't know what kind of codec to use and if it is one that is not in the Vegas list when you "render as", I don't know how to put it there. Should I try to render with the same codec that the original video file was in? I see AVCHD listed, but not H.264 and all the AVCHD ones listed will not let me adjust the frame size. I don't really understand codecs I guess.

    Given the ones I mentioned that the originals are coded in, should I try to encode in something similar to get near lossless quality? If so, how do I get those codecs?

    @racer-x
    Thanks for the code. I looked into FFmpeg and since it will render as avi, won't that mean the file will end up being larger than the original mp4 despite the smaller frame size? I finally got the .bat file to work (ffmpeg does not like files to have spaces in their names) and I'll see what I get from that.
    Quote Quote  
  14. For encoding, I would use AVC / h264 . Vegas's Mainconcept or Sony versions of AVC won't be as good compression/quality wise as x264 , but it's possible to use x264 in vegas with x264vfw . But in general, you're not limited to the drop down menu resolutions (you can select "custom frame size"). You can enter a value with the keyboard

    For ffmpeg, you can enclose with quotes for file names with spaces

    eg. instead of
    -i %%a

    use

    -i "%%a"

    Since the values in the ffmpeg example are hardcoded, you would need to adjust them for the SD clips





    You might encounter other issues like aspect ratio, interlace, but you need to provide more info about the source clips (mediainfo, view=>text)

    https://www.videohelp.com/tools/MediaInfo
    (if you're installing this, remember to uncheckmark the adware install)
    Last edited by poisondeathray; 25th Nov 2014 at 11:28.
    Quote Quote  
  15. @poisondeathray
    I am finding that for the vast majority of the codecs available in the "Render As" window their is no option for custom frame size in the pull down and the entry fields are greyed out, which is why I am asking if anyone knows of a codec that is H.264 and will allow custom frame size.

    I installed the x264vfw codec that you suggested, but I don't know how to select it from the 'Render As' window in Sony Vegas. It does not appear in the list and I don't know how to get it there. I tried searching for how online, but I can't find anything helpful. Do you know?

    @racer-x
    I successfully ran the program and converted the file, but I am not happy with the quality of the end result. It did crop the image which is great, but the video quality was noticeably poorer and the file size was really not much smaller than the original. I am not familiar enough with video editing to know how to change the code or even understand the options. I did try cross-referencing the code with ffmpeg website's documentation but I have no idea what I am doing. Thanks for exposing me to this method which may be satisfactory for other uses in the future.
    Quote Quote  
  16. Are you using vegas pro, or studio ? Some options are locked out in the studio version . Otherwise you can select "custom frame size" and enter a value, or just set it to "use project settings", since you've altered the project settings

    For x264vfw, you need the 64bit version for 64bit vegas, the 32bit version for 32bit vegas. It will be under "Video for Windows AVI" in the export options

    I'm curious about your ffmpeg test. The quality shouldn't be "noticably poorer" , unless there are other special considerations e.g. is source file interlaced? is source file "noisy" ? Maybe posting a sample would help . At the very least, post the mediainfo report. ffmpeg libx264 uses the same library as x264, and x264vfw. So if your results with ffmpeg libx264 aren't ideal - something else is going on, or specific issues need to be addressed
    Quote Quote  
  17. Member racer-x's Avatar
    Join Date
    Mar 2003
    Location
    3rd Rock from the Sun
    Search Comp PM
    I'm curious about your ffmpeg test also. The quality should be similar to source and file size should be much smaller also, since it's 1/4 the resolution.

    Can you post a short (few seconds) source clip?
    Got my retirement plans all set. Looks like I only have to work another 5 years after I die........
    Quote Quote  
  18. @racer-x
    It would be nice to see if I can get both methods to work, but let me first move forward with the Sony Vegas option before I try the ffmpeg.

    @poisondeathray
    I am using Sony Vegas Pro v. 11 64-bit and I installed x264vfw 64-bit. When you say "export options" I assume that you mean "Output Format" in the "Render as" window which has a list that includes "Video for Windows (*.avi)". x264vfw does not appear under "Video for Windows" in the list, even with all the filters removed. How do I get it to appear there for selecting?
    Quote Quote  
  19. Yes, file=>render as. Then in the "save as type" drop down box, select "Video for windows AVI" and push the "custom" button to the right . x264vfw should show up as an option under "video format" . Most people that use x264 with vegas, actually use the debugmode frameserver method . AVI container can be problematic with AVC video, especially when using b-frames. But you can swap containers by remuxing

    But if what you've described with ffmpeg is accurate, with a video 1/4 the dimensions at CRF20, and still roughly the same filesize as the original - that would suggest your video is very difficult to compress (e.g. lots of noise, lots of motion) . No encoder working "as is" is going to do very well. I'm going to guess very likely it was interlaced as well, most "AVCHD" consumer models shoot interlaced. This means you should either encode interlace or deinterlace it before encoding . That ffmpeg commandline was for progressive encoding
    Last edited by poisondeathray; 25th Nov 2014 at 22:49.
    Quote Quote  
  20. I suspect that you are referring to an earlier version of Sony Vegas because my "Render as" window doesn't have what you describe. My window looks like this (found online). However, I must select one of the options below "Video for windows AVI", for example, "HD 1080-24p YUV" and with that selected I hit "Custom Settings" which pulls up a window that has "Video format" with a pull down menu that includes x264vfw. This confuses me because I thought x264vfw would appear in the list under "Video for windows AVI". Even when selecting x264vfw in this way, the notes box at the top of the custom settings window says "using Sony YUV codec", which is also confusing because I thought we were trying to use the x264vfw codec. Anyway, if I do it this way, change the frame to custom size and change the frame rate to 29, and also go into the "Configure" settings for x264vfw and move the slider to max quality, the resulting file is 4x as large as the original and the quality is poorer. It is fuzzier/hazzier. I do not see any kind of interlacing artifacts (horizontal banding).

    I installed debugmode frameserver but have no idea how to use it. Is the purpose of this method just to make the rendering faster?

    When you say, "AVI container can be problematic with AVC video, especially when using b-frames. But you can swap containers by remuxing". What you mean by problematic? I assume that you mean the quality wont' be as good in some way. I would have to ask how to remux into a new container and which container, but let's not go there unless we need to.

    The video sample that I am working with happens to have almost no movement, btw. I say ffmpeg result was lower quality because it looks grainier/more pixelated.

    I installed media info and did not see any options to uncheck, which is disconcerting given that I had several AVG open candy warnings. Not sure what to uninstall to clean the non-media info crap off, but that's neither here nor there.

    Here is the media info for the .mts files (1 of the 3 file types I am dealing with).
    General
    ID : 0 (0x0)
    Complete name : C:\XXXXXXXXXXXXXXXXXXX
    Format : BDAV
    Format/Info : Blu-ray Video
    File size : 1.02 GiB
    Duration : 8mn 29s
    Overall bit rate mode : Variable
    Overall bit rate : 17.2 Mbps
    Maximum Overall bit rate : 18.0 Mbps

    Video
    ID : 4113 (0x1011)
    Menu ID : 1 (0x1)
    Format : AVC
    Format/Info : Advanced Video Codec
    Format profile : High@L4.0
    Format settings, CABAC : Yes
    Format settings, ReFrames : 2 frames
    Format settings, GOP : M=3, N=15
    Codec ID : 27
    Duration : 8mn 27s
    Bit rate mode : Variable
    Bit rate : 16.2 Mbps
    Maximum bit rate : 17.0 Mbps
    Width : 1 920 pixels
    Height : 1 080 pixels
    Display aspect ratio : 16:9
    Frame rate : 29.970 fps
    Color space : YUV
    Chroma subsampling : 4:2:0
    Bit depth : 8 bits
    Scan type : Interlaced
    Scan order : Top Field First
    Bits/(Pixel*Frame) : 0.261
    Stream size : 982 MiB (94%)

    Audio
    ID : 4352 (0x1100)
    Menu ID : 1 (0x1)
    Format : AC-3
    Format/Info : Audio Coding 3
    Mode extension : CM (complete main)
    Format settings, Endianness : Big
    Codec ID : 129
    Duration : 8mn 29s
    Bit rate mode : Constant
    Bit rate : 256 Kbps
    Channel(s) : 2 channels
    Channel positions : Front: L R
    Sampling rate : 48.0 KHz
    Bit depth : 16 bits
    Compression mode : Lossy
    Delay relative to video : -526ms
    Stream size : 15.5 MiB (1%)

    Text
    ID : 4608 (0x1200)
    Menu ID : 1 (0x1)
    Format : PGS
    Codec ID : 144
    Duration : 8mn 27s
    Delay relative to video : 67ms
    Quote Quote  
  21. You push the customize template button. The "template" window name is meaningless. It's the "video format" that you change. There are separate settings for x264vfw, push configure

    AVI container is problematic for some playback software and devices. You can get green/black frames , sync issues (b-frame decoder lag), many problems. A more modern container is MP4, doesn't have those issues, and support on devices is greater . The main reason is temporal compression - the avi container is 1 frame in, 1 frame out, but temporal compression references differences between multiple frames. You can search if you want more information.

    Debugmode frameserver is to enable vegas to "connect" to other programs. It literally "serves frames" to the other program. Why would someone want to do this? Because the quality is higher with x264, (and you might want to use functions/filters in the other programs). x264 the "gold standard" for AVC encoders, even new generation HEVC /h.265 gets compared to it. Simply put, the bundled Mainconcept and Sony codecs aren't as good . You typically need 20-40% higher bitrate to achieve similar quality with typical content .There are many step by step tutorials on how to use debugmode. Some video tutorials on youtube as well

    If you render "progressive", vegas will use the deinterlacing settings specified your project settings. This means you don't see "combing" or interalcing artifacts. But it means if you set it at 29.97 , then you've lost 1/2 the information. You can think of Interlace as "half frames" or fields . You're starting out with 29.97 frames/s or 59.94 fields/s . Those are 59.94 moments in time represented. So you've dumped 1/2 temporal information . If you've bobbed deinterlaced, you should have 59.94 frames/s , retaining the temporal information. This means motion will be smoother. Of course for a static shot, this wont' make much a difference. I don't know what the context is for your project and whether or not this is important for you

    Deinterlacing quality isn't very good in vegas. Deinterlacing is a huge separate topic you could read a book on. There is no "perfect" way to deinterlace, but there are certainly higher quality ways to do it though avisynth (another reason to use debugmode). There are many comparisons posted.

    If you have "noisy" video - noise is the enemy of compression - modern codecs store differences between frames . The larger the differences, the bigger the filesize for a given quantizer. That's why motion and noise will cause you files to be larger. If source is "noisy" then you might consider denoising first, unless preserving the noise was part of your experiment

    For mediainfo, the first screen has a checkmark to "install open candy" or some other junk. You should have uncheckmarked it (hence the warning). I don't know how to properly remove it, use search.
    Quote Quote  
Visit our sponsor! Try DVDFab and backup Blu-rays!