[FFmpeg-user] It is not possible to complete 2 passes/dash

Ferdi Scholten ferdi at sttc-nlp.nl
Fri Sep 6 09:45:39 EEST 2024


> ffmpeg -i {file} -cpu-used 8 -movflags +faststart -map_metadata -1
> -c:v libaom-av1 -pix_fmt yuv420p
> -an
> -map 0:v:0 -filter:v:0 {crop},scale=-2:144,fps={min(30, fps)},setdar=16/9
> -map 0:v:0 -filter:v:1 {crop},scale=-2:240,fps={min(30, fps)},setdar=16/9
> -pass 1 -f null /dev/null &&
> ffmpeg -i {file} -cpu-used 8 -movflags +faststart -map_metadata -1
> -c:v libaom-av1 -pix_fmt yuv420p
> -c:a libopus -b:a 128k
> -map 0:a:0
> -map 0:v:0 -filter:v:0 {crop},scale=-2:144,fps={min(30, fps)},setdar=16/9
> -map 0:v:0 -filter:v:1 {crop},scale=-2:240,fps={min(30, fps)},setdar=16/9
> -init_seg_name "init-$RepresentationID$.$ext$"
> -media_seg_name "chunk-$RepresentationID$-$Number%05d$.$ext$"
> -dash_segment_type auto
> -use_template 1 -use_timeline 1 -seg_duration 10
> -adaptation_sets "id=0, streams=v id=0, streams=a"
> -pass 2 -f dash /mkv_f/manifest.mpd
> """"""
> I don't understand what's going on. Can't do 2 passes...
> If there's one video stream, everything works. But if there are two or more video streams, it gives an error
> """"""
> Error opening file ffmpeg2pass-2.log. [vost#0:2/libaom-av1 @ 0x5596009d8780] Error reading log file 'ffmpeg2pass-2.log' for pass-2 encoding Error opening output file /mkv_f/manifest.mpd. Error opening output files: Input/output error
> """"""
> Experimented with -passlogfile, started to each video stream. Nothing works
> _______________________________________________
>
As far as I know multiple pass encoding only works with one video stream 
at a time.

For every stream you want to encode you need to do seperate multiple 
passes and after separately encoding them, you can mux them together as 
desired.
On suitable hardware you can do these multi pass encodes in parallel 
(multiple encodes at once in separate processes)

So if you have a processor with enough cores You can start two separate 
instances of ffmpeg for encoding each stream. As libaom does not scale 
very well  over multiple cores (on my 8 core system it rarely uses more 
than 4 cores at once) you can assign each proces the desired number of 
cores (threads) for encoding.


More information about the ffmpeg-user mailing list