[FFmpeg-user] help needed, combine three simple calls into one?

Ram Shaffir ram at ram.sh
Sun Nov 29 14:04:20 EET 2020

> > ffmpeg -y -f concat -safe 0 -copyts -i videoList.txt -muxpreload 0
> > -muxdelay 0 -c copy -b:a 128K -cpu-used 0 -preset slow -movflags
> > +faststart -f mp4 concat.mp4
> Make one file out of ??? files. Does this also re-encode anything? (What are
> the input formats? see below)
> > ffmpeg -y -i concat.mp4 -itsoffset 1.9 -i concat.mp4 -c:a aac -c:v
> > copy -map 0:v:0 -map 1:a:0 -f mp4 audioFixed.mp4
> Shift the audio a bit and re-mux.
> > ffmpeg -y -i audioFixed.mp4 -ss 2 -to 17 -c:v copy -c:a aac -f mp4
> > final.mp4
> Select part of the now-shifted file.
> Sometimes, there is no gain to creating more complex directives. In this
> case, it might reduce the amount of de/remux work, but the time-shift
> suggests pretty much means you're stuck with intermediate file(s). Might
> combine the 2nd and 3rd commands.
> Since you only select 17 seconds from the output, you could add a 20 second
> limit to the first step, which would potentially make the intermediate files
> smaller. (Another thing we don't know.)
> Consider using another _container_ type for the intermediate file(s) (e.g.
> nut, avi, or mkv, which can hold the mp4 data).
> You could also, in the first pass, write to separate files for audio and video,
> which might simplify the shift/remux process and then apply the time-based
> selection to that (see
> https://trac.ffmpeg.org/wiki/Creating%20multiple%20outputs).
> Move the "faststart" to the last step since that's where it would matter (it
> gets in the way of piping, if used, and it adds a second file write pass).
> I haven't yet tried any of this, and there's probably an error somewhere in
> there.
> As usual, it really helps to see the command output so we know the file
> formats/etc.
> z!

Many thanks for your detailed reply! It helps us a lot.

More information about the ffmpeg-user mailing list