Correct workflow to use video proxy generated by ffmpeg

Qbrick wrote on 9/7/2023, 4:11 AM

Hi,

what's the correct workflow to use for proxy (via ffmpeg) ?

#############################################

0) copy the scripts

  • Add Proxies as Takes.cs
  • Remove Proxies.cs
  • Switch Proxies.cs
  • Turn off Proxies.cs

from: https://vegasaur.com/bin/scripts

to: "C:\Users\***\Documents\Vegas Script Menu"

1) transcode the big file

ffmpeg -hide_banner -i "input.mkv" -map 0:0 -c:v libx264 -preset ultrafast -vf scale=-2:252 -map 0:1 -c:a copy -f mp4 "output_h250px.mp4"

2) rename input_h250px.mp4 to input_h250px.mp4.sfvp0 (so this sfvp0 file contains video + AAC 5.1 audio)

3) import input_h250px.mp4.sfvp0 on Vegas

4) import input_h250px.mp4.sfvp0 on timeline

4) select video track

5) use Add Proxies as Takes.cs

#############################################

Is it correct? I think no because won't work...

Comments

3POINT wrote on 9/7/2023, 10:09 AM

What's wrong with just using Vegas proxies?

Qbrick wrote on 9/7/2023, 10:14 AM

What's wrong with just using Vegas proxies?

  1. ----- too long process with Vegas style
  2. ++++ customizable quality via ffmpeg
Qbrick wrote on 9/7/2023, 10:31 AM

This workflow does work! 😀

#############################################

0) copy the scripts

  • Add Proxies as Takes.cs
  • Remove Proxies.cs
  • Switch Proxies.cs
  • Turn off Proxies.cs

from: https://vegasaur.com/bin/scripts

to: "C:\Users\***\Documents\Vegas Script Menu"

 

1) transcode the big file to resized file

ffmpeg -hide_banner -i "input.mkv" -map 0:0 -c:v libx264 -preset ultrafast -vf scale=-2:252 -map 0:1 -c:a copy -f mp4 "output_resized.mp4"
note: add "-vf scale=-2:252,format=yuv420p" if you have a 10 bits source version

2) rename output_resized.mp4 to output_resized.mp4.sfvp0 (so this sfvp0 file contains video + AAC 5.1 audio)

 

3) change containers (MKV to MP4) without transcoding

ffmpeg -i input.mkv -map 0:0 -c copy output_resized.mp4

 

4) import output_resized.mp4 on Vegas; then import it on timeline

 

5) select video clip

 

6) use Add Proxies as Takes.cs

#############################################

3d87c4 wrote on 9/7/2023, 1:13 PM

Here's what I do...more or less:

Place original clips in FOLDER1

Create proxies, preferably with identical file names, in FOLDER2. Use these files when editing.

Close Vegas.

Rename FOLDER2 to FOLDER3.

Open Vegas. It won't be able to find the proxies because of the folder name change and prompt you to navigate to the folder containing the videos. Navigate to FOLDER1 and it will use the original clips.
 

If your proxy files have different names than the original clips you will just have to do the navigation step for each clip.

Render.


 

Last changed by 3d87c4 on 9/7/2023, 1:13 PM, changed a total of 1 times.

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

mark-y wrote on 9/7/2023, 5:41 PM

ffmpeg -hide_banner -i "input.mkv" -map 0:0 -c:v libx264 -preset ultrafast -vf scale=-2:250 -map 0:1 -c:a copy -f mp4 "output_resized.mp4"

I'm surprised you find that faster than Vegas proxies, which are XDCAM-EX MPEG-2.

3d87c4 wrote on 9/7/2023, 6:55 PM

@mark-y: FWIW: when I start Vegas I want to edit, not wait for proxy generation, LOL. I queue up proxy generation...handbrake or ffmpeg...and do something else while that processes. Psycho babble, I suppose...

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

wwaag wrote on 9/8/2023, 12:07 AM

Native Vegas proxy creation is just painfully slow, especially for hevc formats. Here's an old comparison I did a number of years back comparing HOS KwikProxy with Vegas.

Even MPEG-2 creation was faster. It's faster for 2 reasons. First, you can render using your GPU and create swap-style or Vegas-style avc proxies (with sfvp0 extension) at the same frame rate as the source footage and second, and the most important reason its faster, it's rendered "outside" of Vegas--it is NOT rendered from the Vegas timeline which is presumably way more complex. As an aside, the resulting avc proxies playback can be a lot smoother since they are not the 720p, 24fps proxies that Vegas creates.

As an example, I recently created proxies for Hero11 UHD 60P 10bit hevc footage using qsv encoding from my A770 card. For whatever reason, GoPro hevc footage is very difficult to decode with preview of only a couple of frames/sec--hence the need for a proxy. The resulting 1080 60P proxies were created 4 times as fast when compared with native proxies (I only rendered a couple for comparison). Moreover, the avc file sizes were smaller with better playback. E.g. a 1:03 GoPro file was 914 MB. The Vegas proxy (Mpeg2, 720, 24P) was 498 MB while the KwikProxy vegas-style proxy (avc, 1080, 60P) file was 312 MB.

For proxy creation outside of Vegas, the easiest thing is just to create swap-style proxies, the type that @3d87c4 is creating and then simply swap between source and proxy. Creating vegas-style proxies is a lot trickier, especially with the later versions of Vegas. Simply rendering a file and adding a .sfvp0 extension usually doesn't work. Unlike earlier versions of Vegas, the one thing you can't have in your vegas-style proxy file is audio. No problem with audio in swap-style proxies.

Last changed by wwaag on 9/8/2023, 12:09 AM, changed a total of 1 times.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

3POINT wrote on 9/8/2023, 2:11 AM

As an aside, the resulting avc proxies playback can be a lot smoother since they are not the 720p, 24fps proxies that Vegas creates.

To my opinion the 720p24 XDCAM proxies just play as smooth (maybe even smoother) as 720/1080p50/60 AVC proxies, because they are played automatically at projectframerate by Vegas. So it doesn't matter that they are just 24p. The XDCAM proxy contains the same amount of frames as the AVC counterpart. Ofcourse XDCAM proxies files are bigger than AVC proxies (mpeg2 vs mp4) and AVC proxies can be quicker generated when you have the right GPU.

Qbrick wrote on 9/8/2023, 3:14 AM

Anyway, for perfect sync frames (between original and proxy) I had to add:

1) add a delay on proxy file:

ffmpeg -hide_banner -i "input.mkv" -ss 00:00:00.042 -map 0:0 -c:v libx264 -preset ultrafast -vf scale=-2:252 "output_resized.mp4"

Important: this delay is not a costant for every project. 🙃

Anyway is simply to find the correct value inside Vegas. ✌️

Set this to "Time" and watch the thousandths:

2) set the same PIXEL ASPECT in Vegas between original and proxy files.

Now, when I switch between original and proxy (with "T" key) file result is correct.

Qbrick wrote on 9/8/2023, 4:19 AM

ffmpeg -hide_banner -i "input.mkv" -map 0:0 -c:v libx264 -preset ultrafast -vf scale=-2:250 -map 0:1 -c:a copy -f mp4 "output_resized.mp4"

I'm surprised you find that faster than Vegas proxies, which are XDCAM-EX MPEG-2.

Hi!

what are the correct codec and params to encode on "XDCAM-EX MPEG-2" via ffmpeg ?

I want to compare. 😇

Thanks!

Qbrick wrote on 9/8/2023, 4:29 AM

Here's what I do...more or less:

Place original clips in FOLDER1

Create proxies, preferably with identical file names, in FOLDER2. Use these files when editing.

Close Vegas.

Rename FOLDER2 to FOLDER3.

Open Vegas. It won't be able to find the proxies because of the folder name change and prompt you to navigate to the folder containing the videos. Navigate to FOLDER1 and it will use the original clips.
 

If your proxy files have different names than the original clips you will just have to do the navigation step for each clip.

Render.


 

Hi!

is the same as using ,right?

From Vegas Help:

mark-y wrote on 9/8/2023, 6:59 AM

what are the correct codec and params to encode on "XDCAM-EX MPEG-2" via ffmpeg ?

Since Vegas proxies are rock solid (and fast) with the venerable Mainconcept encoder, I've never had occasion to use ffmpeg for that. You can analyze a Vegas proxy file to copy the right params. But it should be easier on your resources, both encoding and decoding, than long-GOP AVC.

mark-y wrote on 9/8/2023, 7:15 AM

Vegas proxies are pretty generic (renamed the svp0):

As for my impressions of the ffmpeg MPEG-2 encoder, 😶.

BTW, your fastest encode / decode with x264 is with Baseline Profile (I use a dumbed-down Main Profile), meaning no CABAC and no b-frames, and which not surprisingly is about the same file size as MPEG-2

;?)

mark-y wrote on 9/8/2023, 8:35 AM

@wwaag Thanks for the comparisons!

Native Vegas proxy creation is just painfully slow, especially for hevc formats.

Is it safe to assume that is from hevc decoding and not the proxy encoder?

3d87c4 wrote on 9/8/2023, 2:13 PM

Here's what I do...more or less:

Place original clips in FOLDER1

Create proxies, preferably with identical file names, in FOLDER2. Use these files when editing.

Close Vegas.

Rename FOLDER2 to FOLDER3.

Open Vegas. It won't be able to find the proxies because of the folder name change and prompt you to navigate to the folder containing the videos. Navigate to FOLDER1 and it will use the original clips.
 

If your proxy files have different names than the original clips you will just have to do the navigation step for each clip.

Render.


 

Hi!

is the same as using ,right?

From Vegas Help:

Possibly...I've never done it that way...

Del XPS 17 laptop

Processor    13th Gen Intel(R) Core(TM) i9-13900H   2.60 GHz
Installed RAM    32.0 GB (31.7 GB usable)
System type    64-bit operating system, x64-based processor
Pen and touch    Touch support with 10 touch points

Edition    Windows 11 Pro
Version    22H2
Installed on    ‎6/‎8/‎2023
OS build    22621.1848
Experience    Windows Feature Experience Pack 1000.22642.1000.0

NVIDIA GeForce RTX 4070 Laptop GPU
Driver Version: 31.0.15.2857
8GB memory
 

wwaag wrote on 9/8/2023, 4:55 PM

@mark-y

No, it's both. Decoding is very slow for hevc. Likewise, any encoding from the timeline will be slower than direct encoding from an external app. The trick is to do the external encoding in a manner that Vegas will ingest it and register it as a proxy (if using vegas-style proxies). Swap-style proxies are quite simple.

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

Howard-Vigorita wrote on 9/11/2023, 8:47 AM

Since frame boundaries can be of critical importance in the multicam work I do, I distrust using a 24p proxy when my footage is always 30p or 60p. I prefer to make proxies that are an even division of the footage frame-rate... 1/2 ntsc works quite well for me. Especially if I temporarily set the project rate to match. That alone can obviate the need to even make custom proxies.

When I make custom proxies, I put them in their own folder, similarly as described above. But use the Project Media Swap Video Files function instead of renaming the folders. It's a shame that Vegas' native proxy facility doesn't do exactly what I do... Vegas' ability to disable its proxies during edit by just changing preview resolution is hard to beat. So is automatically switching proxies off for rendering.

Qbrick wrote on 9/11/2023, 8:54 AM

Thanks to all for support.

Anyway I think the best solution for me Is ffmpeg and https://vegasaur.com/bin/scripts 😉

3POINT wrote on 9/11/2023, 9:45 AM

@Howard-Vigorita it's obvious that you don't understand how 24p proxies in Vegas work. It has nothing to do with the framerate of your footage. The Vegas proxies are played at projectframerate and contain the same amount of frames as the original footage. There's no framerate conversion.

Howard-Vigorita wrote on 9/12/2023, 9:57 PM

@3POINT You don't need secret knowledge of the inner workings of Vegas... bottom line is that proxies and projects set at even divisions of the actual frame rate work better, particularly when exact frame boundaries are important. Try it and see.

3POINT wrote on 9/12/2023, 11:18 PM

@Howard-Vigorita you still don't understand that proxies and original footage have the same amount of frames despite their different framerates. When I cut a proxy at frame 1234 it also cuts the original footage at frame 1234, and Visa versa.

wwaag wrote on 9/13/2023, 12:10 AM

I believe that @3POINT is correct. From my limited understanding, when Vegas creates 24P proxies, the length of the proxy file is changed but the number of frames remains the same. As an example, for 60P clips, the length of the proxy will be (60/24) or 2.5 times the length of the original clip. You can verify this using MediaInfo or remove the .sfvp0 extension and add the proxy to the timeline and then switch between 24 and 60 fps and compare framecounts. In this way, Vegas can create a proxy with the same frame count regardless of the frame rate. Although it works, it's just painfully slow, especially for hevc formats--its much faster to create them externally and then swap.

 

AKA the HappyOtter at https://tools4vegas.com/. System 1: Intel i7-8700k with HD 630 graphics plus an Nvidia RTX4070 graphics card. System 2: Intel i7-3770k with HD 4000 graphics plus an AMD RX550 graphics card. System 3: Laptop. Dell Inspiron Plus 16. Intel i7-11800H, Intel Graphics. Current cameras include Panasonic FZ2500, GoPro Hero11 and Hero8 Black plus a myriad of smartPhone, pocket cameras, video cameras and film cameras going back to the original Nikon S.

3POINT wrote on 9/13/2023, 12:35 AM

@wwaag exactly, the 24 proxy is played at 2.5 times speed in a 60 project and about 2 times speed in 50 project. As said many times now, there's no framerate conversion, the proxy contains and shows the same amount of frames as the original footage, just with a lower resolution (720p) and with a less compressed codec (XDCAM).

Proxies were initially created to be able to edit 4k AVC footage on low powered editing PC's with weak GPU, therefore XDCAM was used. On today's PC's with modern GPU there shouldn't be no need to create proxies, even not for HEVC. But in the case you do need proxies even on your modern PC, XDCAM generated proxies sounds outdated and AVC proxies can be created faster due to modern GPU of your modern PC.

Howard-Vigorita wrote on 9/13/2023, 10:08 AM

I believe that @3POINT is correct. From my limited understanding, when Vegas creates 24P proxies, the length of the proxy file is changed but the number of frames remains the same. As an example, for 60P clips, the length of the proxy will be (60/24) or 2.5 times the length of the original clip.

@wwaag Ha, ha, they must be doing temporal dilation which probably also hurts playback performance. What I think is more relevant is that when Vegas internal proxies are active in preview or draft mode, the Project frame-rate does not match the proxy media. Whenever I run Vegas with that kind of mismatch, all other things like frame-size being equal, edit and preview performance suffers. However, if the mismatch is an even division, playback performance increases. Vegas proxies pick up performance from the smaller fame-size but performance could be better with a better frame-rate choice.

In Ntsc-land where I am, I shoot in 30p, 60p, or 120p. If my footage is 60p, which I've been testing lately, setting the project to 30p for editing increases edit performance. Using 1/2 ntsc (there's a Vegas stock setting for that), edit performance is even higher. When I switch it back to 60p for delivery-render, any markers or transition points still align with the frame boundaries I put them on and no artifacts develop. Vegas, btw, does not seem to change the project rate when it's proxies are in effect. That results in an edit performance compromise but markers and transition points should stay aligned to project-frame boundaries which is better for render. I infer the fact that Vegas does not change the project rate when proxies are active from the fact that I can measure better playback performance in an identical project using Xdcam Ex media with the same 24p/720p specs when I explicitly set the project frame rate to match.

In the rest of the world were 25p, 50p and 100p are the standards, I have to wonder if using a 24p proxy is even worth the generating time. Compared to skipping proxies altogether and just setting a project with 50p media to 25p for edit. If I worked with that kind of media, that would be the 1st thing I'd try.

Also, contrary to what was suggested earlier, generating a 24p proxy absolutely requires a frame-rate conversion. Unless your media is 48p or 96p, that conversion requires more complicated math than doing the same transcode to an even division of the source frame-rate. Usually, it's floating-point versus integer. Which likely adds to the processing time.