Built in proxy generation

I’m curious, do you do all of your editing with HuffYUV in Shotcut? Does your computer have all the space for all the HuffYUV usage? I use an external hard drive for Ut Video and the like.

Not all of it(I’ve thrown some quick mp4’s together on occasion without any serious editing) but yes I do any serious editing as HuffYUV at 4k with WAV files for audio. As for space it’s a big dual socket workstation I’ve got a ton of drives in the system including a 1TB NVME just for current projects(along side 2x10tb(raid 1) spinners 2x2tb(raid 0) ssd’s for fast storage and a 500gb os ssd) I typically edit the HuffYUV on the NVME drive and export to the dual ssd raid 0(as both FFV1 and Youtube format) with archived files ending up on the spinners(I don’t keep the huffYUV but I do keep the originals as well as the FFV1)

Oh hey @D_S, because nowadays all computers can decode “audio” with ease. CPU wise, there is no different in using ac-3 or wav.

And @DRM was right, I was talking about temporarily used “lossy low quality proxy”. Actually, small was not part of my criteria, I simply can’t find enough reasons to use wav instead of aac or ac3.

The primary reason that users create proxies with WAV audio is that they like to export audio stems (speech/music/sound effects) out of Shotcut for further processing in a professional DAW. At a minimum, they prefer a DAW over Shotcut to bring levels into compliance with standards like R 128 or A/85. Then they export the mastered audio from their DAW and bring it back into Shotcut for the final render.

It is extremely convenient to do the initial stem export from the proxy side. Otherwise, to get lossless audio to the DAW, the user has to shut down Shotcut, switch to the originals, re-open the project, export the stems, then shut down/switch/re-open again to continue editing. People who care this much about their audio will not like the unnecessary generation of loss due to exporting audio from compressed proxies. The proxy side needs to be lossless for a stem+DAW workflow to achieve the highest quality in the shortest time.

In the grand scheme of things, audio data is a fraction of the size of video data, so storage space is a non-issue. Plus, pcm_s24le always seeks accurately with no latency, no codec delay, no 1024-sample synchronization period at the start, and no A/V sync issues. The same cannot be said for compressed audio formats.

Note that WAV data cannot be put into an MP4 container. This is where Matroska comes in handy.

If for some reason AC-3 is used, it requires more bitrate than AAC to get comparable quality. If an AC-3 stream is going to have further processing, then it needs -b:a 640k to have the best chance of holding up to generation loss.

I think you are conflating proxy with optimized media. My opinion (and how I will approach proxy integration into Shotcut) is that often you should have the option (default on) to generate optimized (edit-friendly) media at the same time as proxy. Otherwise, people will happily edit and just assume the export using source media will seek with the same accuracy as the proxy, which often times may not be the case. Also, to make it manageable and deterministic, I think both media needs to fairly well mirror the source including the number of A/V streams and their order. And yeah, you cannot put uncompressed PCM in mp4 when using that for either proxy or optimized.

I agree 100% with everything you said. But that doesn’t address the workflow issue if a DAW is involved.

Using my own workflow as an example…

Whether optimized media exists or not, I’m going to spend 99.9% of my time on the proxy side so I can edit smoothly. I will only be on the optimized media side to spot-check color grades and do the final export. Therefore, it’s convenient to export audio from the proxy side because that’s where all my time is spent. Otherwise, I would have to shut down/switch/re-open in order to get to the optimized media side to export lossless audio for the DAW and that slows down the workflow tremendously. I now need to shut down/switch/re-open to get back to the proxy side so I can bring the DAW audio into Shotcut and QC it, which obviously can’t be done on the optimized side or we wouldn’t have proxies. Then, if anything is wrong during QC, it’s another two rounds of switching to fix it.

Lossless on the proxy side is about workflow speed for DAW integration, not about optimized media purity.

I realize most people don’t edit this way. I’m simply sharing a use case where some people prefer lossless over compressed proxies.

Is optimized media the same as intermediate files?

I could be completely mistaken that this is related but Austin said way back in this thread this:

Does that not address the issue you bring up here or is it something else?

Close enough for these purposes.

Technically, an intermediate exists because the source is unusable as-is, like cell phone video with variable frame rate that needs conversion to CFR to get frame-accurate seeking. Optimized media, meanwhile, is an optional transcode where the source may be usable as-is, but is too slow at decoding to edit smoothly, so the compression method is changed. When Dan says optimized media, he implies smashing out problems like VFR as well. So the terms basically mean the same thing in this context.

Yes, Dan’s method and my method in that thread are doing the same thing (although I’ve updated the method slightly since then). The scripts I wrote attempt to do some sniffing to see if optimized media is necessary, or if the original video can be used as-is. For some files like the H.264 that comes off of Panasonic mirrorless cameras, the video is already so well-formed that optimized media gains nothing in terms of seek accuracy, so I skip transcoding those. I am unclear if Dan is taking a transcode-all or transcode-some approach for optimized media.

EDIT for clarification: I took the transcode-some approach instead of transcode-all because lossless optimized media is the only way to avoid generation loss in the final render. But those files are huge even if we are accepting ProRes 422 HQ instead of true lossless. If the original video is usable as-is, using it saves transcoding time, storage space for the intermediate, and provides the highest possible quality export.

That’s my question too. :slightly_smiling_face: Your old quote there was a transcode-some approach but from what I understand Dan is talking about making intermediate files as an option that he would encourage. But if your script accounted for it why have it as an option? Does your script account for all cases of bad files that would require generating intermediate files?

People find new ways to create bad files every day. It’s hard to perfectly account for them all. If Dan wants a product with 100% export success and 0% forum complaints, then setting the default to On makes a lot of sense. :slight_smile:

A file can not be used by Shotcut therefore need to be converted first is not called “intermediate”. The file is called “unsupported file” and the conversion result is the actual “source”. This conversion need to be taken care of by users.

Basically, there are 3 format conversions we are looking at:

  • Optimized files:
    Lossless or super high quality. frame-rate can be changed for better, edit-friendly.
    It’s used to permanently replace the source files in the editor.

  • Proxy files:
    Very low quality, but the number of frames should stay the same, super-edit-friendly.
    It is a temporary placeholder for smooth editing, will be removed soon after the editing.

  • Cache files:
    Medium quality
    Editor generated segment files for faster live preview during the editing.

If your file is out of these three categories (like @Austin may want a proxy file with lossless audio, something between catagory 1 and 2), you may need your own script to do the conversion.

Sorry that my writing style was unclear. I was trying to say that if a video is not usable as-is and needs to be converted, then the converted file is called an intermediate … and then that’s why an intermediate would exist in the first place.

Hey, @Austin as a token of my gratitude for your bits of help in solving a problem in my program, I made you a special lossless-audio version of the “proxy auto-creation” tool:

It generates proxy-videos with “lossless audio” (H264 + Apple Lossless Audio Codec) , as so you can import/export lossless audios easily during the proxy-editing phase.

Wish it helps your workflow.

Scroll to the page bottom to download https://kknbb.party/stories/shotcut-proxy-creation-tool/

That’s so cool! That’s a great codec combination too. Glad to help.

@shotcut,
Since the proxy feature is getting closer to debut, I wanted to bring up some questions I have as well as make a suggestion.

  • Are there going to be options for choosing the specific kind of video and audio codecs for the proxies as well as choosing whatever size the user wants?

  • I don’t know if making proxies for png images is common but big png files can slow down playback. Will the proxy feature also be able to make proxies for png images?

  • With multi-select having been implemented, will this also be incorporated into making proxies by being able to choose more than one file to line up for proxy rendering? Or will they have to be selected for proxy creations one by one?

  • Currently, the way to reverse footage in Shotcut is that it has to export the selected section then bring it back into Shotcut. If there is a project that is being worked while in proxy mode, will the proxy generator automatically address that?

  • Will there be a toggling shortcut key available like with Preview Scaling to quickly turn on and off proxy mode?

  • Will the user be able to pick where to store the proxies for a project?

  • If I create a proxy out of a video source but I also want to use that same video source in a separate project, will Shotcut allow me to reuse the proxy I already created in the first project so that I won’t have to waste time regenerating a new proxy for the second project?

  • If a big video file is brought in that also includes the alpha channel, will Shotcut’s proxy generator be able to detect that and make a special proxy render that will keep the alpha channel?

The suggestion I have has to do with a proxy feature menu.I was wondering if there could be simple and advanced versions of the proxy feature menu. A simple menu version could be something similar to the Convert To Edit Friendly menu that has a slider with different options and a short description of what each is about except here it would two categories for the options: One for the codec and the other for the resolution. The slider option for resolution options could be 360p, 540p and 720p to match the Preview Scaling options. The first option for codecs could be some kind of fast one similar to what @KKnBB’s proxy generator produces which would render the smallest file size. A second option going up in file size but also in quality would be DNxHR LB and the third option being the biggest file size but with the highest quality proxy image would be ProRes Proxy. I think having a simple menu like that would make it very understandable for newcomers while having an advanced menu with more options and controls for users that know what they are doing.

@Austin, by the way have you tried ProRes Proxy before? I tested it and the image comes out very close to a Ut Video render with low resolution but with a far smaller file size.

I haven’t taken any interest in ProRes Proxy because it is unpredictable on two levels. First, the codec itself reduces the video to quarter resolution. So if my goal is to produce a 360p proxy video, the only way I get actual 360p is if my source happens to be 1440p. For scripting operations, this sacrifices a lot of control or adds a lot of scripting complexity. Secondly, ProRes Proxy discards more color information than the other variants. Try adding a significant color grade to a ProRes Proxy clip and it won’t hold up nearly as well as Ut Video or other variants. Everybody has different project requirements, but mine include the ability to color grade quite accurately on proxies.

FWIW when it comes to folder structure, my generation scripts use a trickle-down approach. There is a project folder, and underneath are three subfolders: “Original”, “Intermediate”, “Proxy”. The user works exclusively in the “Original” folder. This is where the user adds and organizes their media. My proxy scripts do not ever modify the contents of the user’s “Original” folder.

When the proxy script is kicked off, it compares the contents of the “Original” folder to the “Intermediate” folder. Files that match by name and date stamp are considered up-to-date and not modified. If the “Intermediate” folder is missing a file that exists in “Original”, the script determines if any issues exist that would require transcoding (like VFR). If so, it transcodes and sets the modification date to match “Original”. If transcoding is not needed, then the script creates a hard link in the “Intermediate” folder to the file in “Original”. This is a filesystem feature that allows two file entries in the file allocation table to point to the exact same block of data on disk, meaning no additional disk space (or copy time) is consumed for the “Intermediate copy” of the file in “Original”.

Lastly, the “Proxy” folder is full of transcodes of the “Intermediate” folder.

The user works in “Original” and doesn’t touch “Intermediates” or “Proxy”. The system maintains sync in “Intermediates” and “Proxy”, and never touches “Original”. Switching between proxy and intermediate sides is as simple as renaming the folders. It has worked very well for a couple years and saves tons of disk space when working with well-formed files produced by good cameras.

@DRM The answer to all of your questions is no, and I have not even started on the proxy feature. Now, I believe I will be unable to make user’s happy with what I had planned for my minimal implementation in a near term release because it will fall well short of expectations. Also, I have decided to work full time on something else other than Shotcut for a while and have less time to give. Consequently, proxy is no longer in scope for the next version. Maybe I will work on it off-and-on in a branch over the course of several months with no ETA but I have not decided.

I was just reminded of this thread. :slightly_smiling_face: It’s been almost 2 years @D_S since you started it and proxy finally got added this past June. I suppose out of some closure for the thread, I’m curious about what you think of the Shotcut’s proxy after it finally got implemented?

I got so used to just making huffYUV files and doing things manually I haven’t tired it, but I’ve got a review on a thunderbolt 3 10GbaseT adapter I need to do i’ll try it with.

See Proxy Editing