Batch Export profile

I always end up exporting my projects at least twice, once as a archival FFV1 to keep and another as a youtube mp4 to upload, it would be nice if there was a way to setup a batch export that just spits out projectname_preset.extension without having to manually do it each time

Any interest in exporting the FFV1 from Shotcut first, then using a folder watchdog to see the FFV1 come in and use ffmpeg to convert FFV1 to MP4? In theory, ffmpeg conversion from the FFV1 would be faster because filters don’t have to be recalculated from the Shotcut project.

I considered something like that and although it might be faster there’s always the potential for quality loss so if I have the original it seems silly to invite it, plus I typically store projects on an NVME drive while editing and export to an SSD Raid(granted the decrease in filter calculation would probably more than account for reading and writing to the same drive)

Which quality loss are you concerned about? If FFV1 isn’t doing a perfect job for you, then shouldn’t its suitability as an archive format be questioned?

just conversion introducing artifacts, FFV1 might be theoretically perfect but if I feed it through FFMPEG enough times i’ll accumulate errors, if I still have the original source it’s better to not add an extra step if you can avoid it.

At a theoretical level, I 100% agree that’s the path to perfection. At a practical level, a libx264/libx265 encoding (short of lossless) is not able to capture and represent that small of an accumulated error, should one even happen. Their encoders strip out differences that small to increase compression efficiency. There shouldn’t be any visible harm in using an FFV1 master for all lossy transcodes. The lossy formats aren’t good enough to visibly reproduce errors that small, by design to get file size down.

I confess, I’ve never done a deep multi-generational test on FFV1, and this possibility scared me a little. So I tried it out.

// Generate a 15-second source FFV1
ffmpeg -i SomeSourceMovie.mp4 -t 00:00:15.000 -c:v ffv1 -an ffv1.01.mkv

// Transcode 10 generations of FFV1
ffmpeg -i ffv1.01.mkv -c:v ffv1 -an ffv1.02.mkv
ffmpeg -i ffv1.02.mkv -c:v ffv1 -an ffv1.03.mkv
ffmpeg -i ffv1.03.mkv -c:v ffv1 -an ffv1.04.mkv
ffmpeg -i ffv1.04.mkv -c:v ffv1 -an ffv1.05.mkv
ffmpeg -i ffv1.05.mkv -c:v ffv1 -an ffv1.06.mkv
ffmpeg -i ffv1.06.mkv -c:v ffv1 -an ffv1.07.mkv
ffmpeg -i ffv1.07.mkv -c:v ffv1 -an ffv1.08.mkv
ffmpeg -i ffv1.08.mkv -c:v ffv1 -an ffv1.09.mkv
ffmpeg -i ffv1.09.mkv -c:v ffv1 -an ffv1.10.mkv

// Extract frames at 5-second mark from generations 1 and 10
ffmpeg -ss 00:00:05.000 -i ffv1.01.mkv -frames:v 1 ffv1.01.png
ffmpeg -ss 00:00:05.000 -i ffv1.10.mkv -frames:v 1 ffv1.10.png

// Binary compare the extracted images
fc /b ffv1.01.png ffv1.10.png
FC: no differences encountered

It appears that FFV1 will do a heroic job of preserving whatever Shotcut hands down to it at export time, meaning there’s nothing to be gained by reprocessing the source. All paths end up in the same place, so it doesn’t matter to me which way you go about it, but I wanted to open up potential options in your workflow if FFV1 conversion errors were the obstacle holding you back from something different.

I hope I don’t sound harpy about this. It’s just that the “lossless master for a multitude of lossy transcodes as needed” is a pretty standard workflow, and one that I recommend to a lot of people with that need. If it isn’t working for somebody, I’d like to figure out why and then how to fix it so I’m not giving people bad recommendations.

Maybe I will just setup a monitor with a filter, I suppose I should download FFAStrans and give that a try

I didn’t know FFAStrans even existed. Looks really powerful. Thanks for the pointer!

I used it for audio work ages ago to monitor a folder that was receiving wav files and make mp3’s out of them

It should be fairly easy to integrate Shotcut export/(q)melt into this to offload that step as well by feeding it your project file (or folder if using relative paths). Save As? You basically setup a custom node to run
qmelt -consumer avformat:{output-file.ext} properties={export-preset-file} {mlt-xml-file}
without the curly braces.

It might be a little more complicated than that if your preset does not contain everything about bitrates/quality, rate control, GOP, etc. That is because a preset can be a subset of all params especially the stock ones from MLT. Shotcut reads the preset and updates its Export UI. Then, it creates the actual parameters, which depends on the video codec, when you Export File. If you configure everything and add a custom preset then you get full details and can omit things that are project specific like resolution, aspect ratio, and frame rate.

So let me just make sure I’m fully comprehending that, instead of having to feed an export through you think I could setup FFAStrans in such a way it will ingest the project as a whole and then spit out whatever file(s) I want in one step?