Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Jeff Langston
Hi all,

I'm trying to sort out an issue  I've run into with ffmpeg on the cli and
was wondering if anyone might be able to help. I am trying to leverage 2
pass encoding as well as inputting additional audio tracks to generate
multiple output versions  (MPEG-DASH/HLS/MP4/MP3).

During the 2nd pass I'm hitting an error `ratecontrol_init: can't open
stats file` The same command when done in a single pass seems to work ok
but yields larger rendered file sizes than what 2 pass encoding generates

Would anyone have any idea if it should be expected to be able to leverage
2 pass encoding in this fashion to support multiple audio inputs or if
there are changes I might need to make to the cli args ?

Full commands and their output avail here https://pastebin.com/GDcAR1rV

Any input or help would be greatly  appreciated.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Carl Eugen Hoyos-2
Am Sa., 14. März 2020 um 06:04 Uhr schrieb Jeff Langston <[hidden email]>:

> I'm trying to sort out an issue  I've run into with ffmpeg on the cli and
> was wondering if anyone might be able to help. I am trying to leverage 2
> pass encoding as well as inputting additional audio tracks to generate
> multiple output versions  (MPEG-DASH/HLS/MP4/MP3).
>
> During the 2nd pass I'm hitting an error `ratecontrol_init: can't open
> stats file` The same command when done in a single pass seems to work ok
> but yields larger rendered file sizes than what 2 pass encoding generates
>
> Would anyone have any idea if it should be expected to be able to leverage
> 2 pass encoding in this fashion to support multiple audio inputs or if
> there are changes I might need to make to the cli args ?
>
> Full commands and their output avail here https://pastebin.com/GDcAR1rV

Please test current FFmpeg git head and provide all necessary information
(like command line including complete, uncut console output) here on the
mailing list, only use external resources for input files.

And please try to simplify your example.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Jeff Langston
Hi,

Here's the input commands boiled down to the simplest reproducible
versions.

Here's links to the input files https://s3.amazonaws.com/Jlangston/bunny.mp4
https://s3.amazonaws.com/Jlangston/track1.m4a
Trying either without the 2nd audio input or without rendering multiple
video versions with multiple audio tracks seems to work but the combination
of multiple input audio tracks and multiple output versions is hitting.
Which I am guessing might be around the usage of the -passlogfile option.

[libx264 @ 0x5562fa469c80] ratecontrol_init: can't open stats file
Error initializing output stream 0:2 -- Error while opening encoder for
output stream #0:2 - maybe incorrect parameters such as bit_rate, rate,
width or height

If I leave out the -passlogfile option I get a message about failure to
rename log file in pass1.

[libx264 @ 0x5621f1bcdfc0] failed to rename "ffmpeg2pass-0.log.temp" to
"ffmpeg2pass-0.log"
[libx264 @ 0x5621f1bcdfc0] failed to rename "ffmpeg2pass-0.log.mbtree.temp"
to "ffmpeg2pass-0.log.mbtree"

Here's the commands and their outputs below. Thank you in advance for any
assitance or guidance you might be able to provide as well as everyone's
work on ffmpeg.

Pass 1:
ffmpeg \
-i ./bunny.mp4 \
-i ./track1.m4a \
-loglevel debug -v verbose \
-map 0:a \
-metadata:s:a:0 language=en \
-metadata:s:a:0 title=track_one \
-map 1:a \
-metadata:s:a:1 language=ch \
-metadata:s:a:1 title=track_two \
-f dash \
-map 0:v:0 \
-s:v:0 1920x1080 \
-b:v:0 1460k \
-passlogfile:0 1080p \
-map 0:v:0 \
-b:v:1 683k \
-s:v:1 1280x720 \
-passlogfile:1 720p \
-c:v libx264 \
-profile:v baseline \
-movflags faststart \
-r 30 \
-seg_duration 4 \
-single_file 1 \
-hls_playlist 1 \
-streaming 1 \
-dash_segment_type mp4 \
-pass 1 \
-an \
-f mp4 /dev/null

Pass 2:
ffmpeg -y \
-i ./bunny.mp4 \
-i ./track1.m4a \
-loglevel debug -v verbose \
-map 0:a \
-metadata:s:a:0 language=en \
-metadata:s:a:0 title=track_two \
-map 1:a \
-metadata:s:a:1 language=ch \
-metadata:s:a:1 title=track_one \
-f dash \
-map 0:v:0 \
-s:v:0 1920x1080 \
-b:v:0 1460k \
-passlogfile:0 1080p \
-map 0:v:0 \
-b:v:1 683k \
-s:v:1 1280x720 \
-passlogfile:1 720p \
-profile:v baseline \
-movflags faststart \
-r 30 \
-seg_duration 4 \
-single_file 1 \
-hls_playlist 1 \
-streaming 1 \
-dash_segment_type mp4 \
-pass 2 ./out/out.mpd

Output from pass 1:

ffmpeg version N-96963-gfa5bff611d Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 9.2.1 (Arch Linux 9.2.1+20200130-2) 20200130
  configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
--enable-gpl --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack
--enable-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex
--enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
--enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 42.100 / 56. 42.100
  libavcodec     58. 75.100 / 58. 75.100
  libavformat    58. 41.100 / 58. 41.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument '../bunny.mp4'.
Reading option '-i' ... matched as input url with argument '../track1.m4a'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'verbose'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:a'.
Reading option '-metadata:s:a:0' ... matched as option 'metadata' (add
metadata) with argument 'language=en'.
Reading option '-metadata:s:a:0' ... matched as option 'metadata' (add
metadata) with argument 'title=track_one'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '1:a'.
Reading option '-metadata:s:a:1' ... matched as option 'metadata' (add
metadata) with argument 'language=ch'.
Reading option '-metadata:s:a:1' ... matched as option 'metadata' (add
metadata) with argument 'title=track_two'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'dash'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:v:0'.
Reading option '-s:v:0' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1920x1080'.
Reading option '-b:v:0' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '1460k'.
Reading option '-passlogfile:0' ... matched as option 'passlogfile' (select
two pass log file name prefix) with argument '1080p'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:v:0'.
Reading option '-b:v:1' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '683k'.
Reading option '-s:v:1' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1280x720'.
Reading option '-passlogfile:1' ... matched as option 'passlogfile' (select
two pass log file name prefix) with argument '720p'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument
'libx264'.
Reading option '-profile:v' ... matched as option 'profile' (set profile)
with argument 'baseline'.
Reading option '-movflags' ... matched as AVOption 'movflags' with argument
'faststart'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '30'.
Reading option '-seg_duration' ... matched as AVOption 'seg_duration' with
argument '4'.
Reading option '-single_file' ... matched as AVOption 'single_file' with
argument '1'.
Reading option '-hls_playlist' ... matched as AVOption 'hls_playlist' with
argument '1'.
Reading option '-streaming' ... matched as AVOption 'streaming' with
argument '1'.
Reading option '-dash_segment_type' ... matched as AVOption
'dash_segment_type' with argument 'mp4'.
Reading option '-pass' ... matched as option 'pass' (select the pass number
(1 to 3)) with argument '1'.
Reading option '-an' ... matched as option 'an' (disable audio) with
argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'mp4'.
Reading option '/dev/null' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option v (set logging level) with argument verbose.
[h264 @ 0x55d3b8f26480] Reinit context to 1920x1088, pix_fmt: yuv420p
Guessed Channel Layout for Input Stream #0.1 : 5.1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../bunny.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:01:00.02, start: 0.000000, bitrate: 5291 kb/s
    Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 /
0x31637661), yuv420p(left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 4892
kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1,
fltp, 395 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '../track1.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    title           : AxelF
    encoder         : Lavf58.29.100
    comment         : by www.OnlineMusicRecorder.com
    genre           : Blues
  Duration: 00:01:00.02, start: 0.000000, bitrate: 131 kb/s
    Stream #1:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 130 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
File '/dev/null' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 0x55d3b8f42740] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph 0 input from stream 0:0 @ 0x55d3b97683c0] w:1920 h:1080
pixfmt:yuv420p tb:1/12288 fr:24/1 sar:1/1
[scaler_out_0_0 @ 0x55d3b976a3c0] w:1920 h:1080 flags:'bicubic' interl:0
[scaler_out_0_0 @ 0x55d3b976a3c0] w:1920 h:1080 fmt:yuv420p sar:1/1 ->
w:1920 h:1080 fmt:yuv420p sar:1/1 flags:0x4
[libx264 @ 0x55d3b8f3db80] using SAR=1/1
[libx264 @ 0x55d3b8f3db80] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d3b8f3db80] profile Constrained Baseline, level 4.0, 4:2:0,
8-bit
[libx264 @ 0x55d3b8f3db80] 264 - core 159 r2991 1771b55 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options:
cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1
bitrate=1460 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
[graph 1 input from stream 0:0 @ 0x55d3ba1d68c0] w:1920 h:1080
pixfmt:yuv420p tb:1/12288 fr:24/1 sar:1/1
[scaler_out_0_1 @ 0x55d3ba1d70c0] w:1280 h:720 flags:'bicubic' interl:0
[scaler_out_0_1 @ 0x55d3ba1d70c0] w:1920 h:1080 fmt:yuv420p sar:1/1 ->
w:1280 h:720 fmt:yuv420p sar:1/1 flags:0x4
[libx264 @ 0x55d3b8f8da80] using SAR=1/1
[libx264 @ 0x55d3b8f8da80] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x55d3b8f8da80] profile Constrained Baseline, level 3.1, 4:2:0,
8-bit
[libx264 @ 0x55d3b8f8da80] 264 - core 159 r2991 1771b55 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options:
cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=abr mbtree=1
bitrate=683 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00
Output #0, mp4, to '/dev/null':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.41.100
    Stream #0:0(und): Video: h264 (libx264), 1 reference frame (avc1 /
0x31637661), yuv420p(progressive, left), 1920x1080 [SAR 1:1 DAR 16:9],
q=-1--1, 1460 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.75.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/1460000 buffer size: 0 vbv_delay: N/A
    Stream #0:1(und): Video: h264 (libx264), 1 reference frame (avc1 /
0x31637661), yuv420p(left), 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 683 kb/s,
30 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.75.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/683000 buffer size: 0 vbv_delay: N/A
*** 1 dup!
    Last message repeated 21 times
*** 1 dup!6 fps=0.0 q=32.0 q=35.0 size=       0kB time=00:00:00.06 bitrate=
  5.8kbits/s dup=22 drop=0 speed=0.133x
    Last message repeated 27 times
*** 1 dup!5 fps=123 q=43.0 q=43.0 size=     768kB time=00:00:02.36
bitrate=2658.5kbits/s dup=50 drop=0 speed=2.33x
    Last message repeated 29 times
*** 1 dup!0 fps=132 q=39.0 q=38.0 size=    1280kB time=00:00:04.86
bitrate=2154.7kbits/s dup=80 drop=0 speed= 3.2x
    Last message repeated 29 times
*** 1 dup!5 fps=136 q=38.0 q=37.0 size=    1792kB time=00:00:07.36
bitrate=1992.8kbits/s dup=110 drop=0 speed=3.63x
    Last message repeated 29 times
*** 1 dup!0 fps=138 q=39.0 q=38.0 size=    2560kB time=00:00:09.86
bitrate=2125.5kbits/s dup=140 drop=0 speed=3.88x
    Last message repeated 29 times
*** 1 dup!5 fps=139 q=39.0 q=39.0 size=    3328kB time=00:00:12.36
bitrate=2204.6kbits/s dup=170 drop=0 speed=4.06x
    Last message repeated 31 times
*** 1 dup!5 fps=142 q=38.0 q=38.0 size=    3840kB time=00:00:15.03
bitrate=2092.5kbits/s dup=202 drop=0 speed=4.22x
    Last message repeated 35 times
*** 1 dup!5 fps=147 q=36.0 q=36.0 size=    4352kB time=00:00:18.03
bitrate=1977.0kbits/s dup=238 drop=0 speed=4.44x
    Last message repeated 33 times
*** 1 dup!1 fps=149 q=35.0 q=35.0 size=    4864kB time=00:00:20.90
bitrate=1906.5kbits/s dup=272 drop=0 speed=4.58x
    Last message repeated 29 times
*** 1 dup!5 fps=149 q=35.0 q=35.0 size=    5632kB time=00:00:23.36
bitrate=1974.5kbits/s dup=302 drop=0 speed= 4.6x
    Last message repeated 25 times
*** 1 dup!9 fps=147 q=37.0 q=37.0 size=    6656kB time=00:00:25.50
bitrate=2138.3kbits/s dup=328 drop=0 speed=4.57x
    Last message repeated 25 times
*** 1 dup!5 fps=145 q=38.0 q=38.0 size=    7424kB time=00:00:27.70
bitrate=2195.6kbits/s dup=354 drop=0 speed=4.55x
    Last message repeated 25 times
*** 1 dup!1 fps=144 q=39.0 q=39.0 size=    8192kB time=00:00:29.90
bitrate=2244.5kbits/s dup=380 drop=0 speed=4.53x
    Last message repeated 25 times
*** 1 dup!5 fps=143 q=40.0 q=40.0 size=    9216kB time=00:00:32.03
bitrate=2356.8kbits/s dup=406 drop=0 speed=4.51x
    Last message repeated 27 times
*** 1 dup!7 fps=143 q=41.0 q=40.0 size=    9984kB time=00:00:34.43
bitrate=2375.3kbits/s dup=434 drop=0 speed=4.52x
    Last message repeated 31 times
*** 1 dup!5 fps=144 q=40.0 q=40.0 size=   10240kB time=00:00:37.03
bitrate=2265.2kbits/s dup=466 drop=0 speed=4.57x
    Last message repeated 31 times
*** 1 dup!4 fps=144 q=39.0 q=39.0 size=   10752kB time=00:00:39.66
bitrate=2220.5kbits/s dup=498 drop=0 speed=4.61x
    Last message repeated 29 times
*** 1 dup!2 fps=145 q=38.0 q=38.0 size=   11008kB time=00:00:42.26
bitrate=2133.5kbits/s dup=528 drop=0 speed=4.64x
    Last message repeated 29 times
*** 1 dup!7 fps=145 q=37.0 q=37.0 size=   11520kB time=00:00:44.76
bitrate=2108.1kbits/s dup=558 drop=0 speed=4.66x
    Last message repeated 31 times
*** 1 dup!5 fps=146 q=37.0 q=37.0 size=   12032kB time=00:00:47.36
bitrate=2080.9kbits/s dup=590 drop=0 speed=4.68x
    Last message repeated 27 times
*** 1 dup!5 fps=146 q=38.0 q=38.0 size=   12800kB time=00:00:49.70
bitrate=2109.8kbits/s dup=618 drop=0 speed=4.68x
    Last message repeated 29 times
*** 1 dup!0 fps=146 q=38.0 q=38.0 size=   13568kB time=00:00:52.20
bitrate=2129.3kbits/s dup=648 drop=0 speed=4.69x
    Last message repeated 31 times
*** 1 dup!9 fps=146 q=37.0 q=37.0 size=   14080kB time=00:00:54.83
bitrate=2103.5kbits/s dup=680 drop=0 speed=4.72x
    Last message repeated 35 times
*** 1 dup!0 fps=148 q=37.0 q=37.0 size=   14592kB time=00:00:57.86
bitrate=2065.7kbits/s dup=716 drop=0 speed=4.77x
    Last message repeated 3 times
No more output streams to write to, finishing.
[mp4 @ 0x55d3b8f3f080] Starting second pass: moving the moov atom to the
beginning of the file
[AVIOContext @ 0x55d3bacf8f80] Statistics: 0 bytes read, 0 seeks
frame= 1800 fps=147 q=-1.0 Lq=-1.0 size=   14977kB time=00:00:59.96
bitrate=2046.0kbits/s dup=720 drop=0 speed=4.88x
video:14977kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000326%
Input file #0 (../bunny.mp4):
  Input stream #0:0 (video): 1440 packets read (36695193 bytes); 1440
frames decoded;
  Input stream #0:1 (audio): 1 packets read (164 bytes);
  Total: 1441 packets (36695357 bytes) demuxed
Input file #1 (../track1.m4a):
  Input stream #1:0 (audio): 0 packets read (0 bytes);
  Total: 0 packets (0 bytes) demuxed
Output file #0 (/dev/null):
  Output stream #0:0 (video): 1800 frames encoded; 1800 packets muxed
(10410658 bytes);
  Output stream #0:1 (video): 1800 frames encoded; 1800 packets muxed
(4925944 bytes);
  Total: 3600 packets (15336602 bytes) muxed
[AVIOContext @ 0x55d3b8f8cf80] Statistics: 4 seeks, 62 writeouts
[libx264 @ 0x55d3b8f3db80] frame I:11    Avg QP:26.18  size:105427
[libx264 @ 0x55d3b8f3db80] frame P:1789  Avg QP:30.90  size:  5171
[libx264 @ 0x55d3b8f3db80] mb I  I16..4: 54.4%  0.0% 45.6%
[libx264 @ 0x55d3b8f3db80] mb P  I16..4:  4.4%  0.0%  0.0%  P16..4: 17.3%
 0.0%  0.0%  0.0%  0.0%    skip:78.3%
[libx264 @ 0x55d3b8f3db80] final ratefactor: 31.22
[libx264 @ 0x55d3b8f3db80] coded y,uvDC,uvAC intra: 10.5% 22.5% 4.2% inter:
2.7% 3.0% 0.1%
[libx264 @ 0x55d3b8f3db80] i16 v,h,dc,p: 57% 22% 13%  8%
[libx264 @ 0x55d3b8f3db80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 13% 16%  9%
 8%  9%  6% 10%  6%
[libx264 @ 0x55d3b8f3db80] i8c dc,h,v,p: 70% 16% 13%  2%
[libx264 @ 0x55d3b8f3db80] kb/s:1388.00
[libx264 @ 0x55d3b8f8da80] frame I:13    Avg QP:26.38  size: 47404
[libx264 @ 0x55d3b8f8da80] frame P:1787  Avg QP:31.82  size:  2411
[libx264 @ 0x55d3b8f8da80] mb I  I16..4: 59.3%  0.0% 40.7%
[libx264 @ 0x55d3b8f8da80] mb P  I16..4:  3.8%  0.0%  0.0%  P16..4: 18.7%
 0.0%  0.0%  0.0%  0.0%    skip:77.5%
[libx264 @ 0x55d3b8f8da80] final ratefactor: 30.99
[libx264 @ 0x55d3b8f8da80] coded y,uvDC,uvAC intra: 11.7% 22.2% 5.5% inter:
3.0% 2.9% 0.1%
[libx264 @ 0x55d3b8f8da80] i16 v,h,dc,p: 56% 23% 13%  9%
[libx264 @ 0x55d3b8f8da80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 13% 16%  9%
 9%  9%  7% 11%  7%
[libx264 @ 0x55d3b8f8da80] i8c dc,h,v,p: 72% 15% 11%  2%
[libx264 @ 0x55d3b8f8da80] kb/s:656.71
[AVIOContext @ 0x55d3b8f2d5c0] Statistics: 39743617 bytes read, 2 seeks
[AVIOContext @ 0x55d3b8f29f80] Statistics: 76751 bytes read, 2 seeks

Output Pass 2:
ffmpeg version N-96963-gfa5bff611d Copyright (c) 2000-2020 the FFmpeg
developers
  built with gcc 9.2.1 (Arch Linux 9.2.1+20200130-2) 20200130
  configuration: --prefix=/usr --disable-debug --disable-static
--disable-stripping --enable-fontconfig --enable-gmp --enable-gnutls
--enable-gpl --enable-ladspa --enable-libaom --enable-libass
--enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype
--enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack
--enable-libmfx --enable-libmodplug --enable-libmp3lame
--enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg
--enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex
--enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264
--enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid
--enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 42.100 / 56. 42.100
  libavcodec     58. 75.100 / 58. 75.100
  libavformat    58. 41.100 / 58. 41.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.100 /  7. 77.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with
argument '1'.
Reading option '-i' ... matched as input url with argument '../bunny.mp4'.
Reading option '-i' ... matched as input url with argument '../track1.m4a'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging
level) with argument 'debug'.
Reading option '-v' ... matched as option 'v' (set logging level) with
argument 'verbose'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:a'.
Reading option '-metadata:s:a:0' ... matched as option 'metadata' (add
metadata) with argument 'language=en'.
Reading option '-metadata:s:a:0' ... matched as option 'metadata' (add
metadata) with argument 'title=track_two'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '1:a'.
Reading option '-metadata:s:a:1' ... matched as option 'metadata' (add
metadata) with argument 'language=ch'.
Reading option '-metadata:s:a:1' ... matched as option 'metadata' (add
metadata) with argument 'title=track_one'.
Reading option '-f' ... matched as option 'f' (force format) with argument
'dash'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:v:0'.
Reading option '-s:v:0' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1920x1080'.
Reading option '-b:v:0' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '1460k'.
Reading option '-passlogfile:0' ... matched as option 'passlogfile' (select
two pass log file name prefix) with argument '1080p'.
Reading option '-map' ... matched as option 'map' (set input stream
mapping) with argument '0:v:0'.
Reading option '-b:v:1' ... matched as option 'b' (video bitrate (please
use -b:v)) with argument '683k'.
Reading option '-s:v:1' ... matched as option 's' (set frame size (WxH or
abbreviation)) with argument '1280x720'.
Reading option '-passlogfile:1' ... matched as option 'passlogfile' (select
two pass log file name prefix) with argument '720p'.
Reading option '-profile:v' ... matched as option 'profile' (set profile)
with argument 'baseline'.
Reading option '-movflags' ... matched as AVOption 'movflags' with argument
'faststart'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value,
fraction or abbreviation)) with argument '30'.
Reading option '-seg_duration' ... matched as AVOption 'seg_duration' with
argument '4'.
Reading option '-single_file' ... matched as AVOption 'single_file' with
argument '1'.
Reading option '-hls_playlist' ... matched as AVOption 'hls_playlist' with
argument '1'.
Reading option '-streaming' ... matched as AVOption 'streaming' with
argument '1'.
Reading option '-dash_segment_type' ... matched as AVOption
'dash_segment_type' with argument 'mp4'.
Reading option '-pass' ... matched as option 'pass' (select the pass number
(1 to 3)) with argument '2'.
Reading option '../out/out.mpd' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Applying option v (set logging level) with argument verbose.
[h264 @ 0x5562fa405400] Reinit context to 1920x1088, pix_fmt: yuv420p
Guessed Channel Layout for Input Stream #0.1 : 5.1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '../bunny.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:01:00.02, start: 0.000000, bitrate: 5291 kb/s
    Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 /
0x31637661), yuv420p(left), 1920x1080 (1920x1088) [SAR 1:1 DAR 16:9], 4892
kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1,
fltp, 395 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '../track1.m4a':
  Metadata:
    major_brand     : M4A
    minor_version   : 512
    compatible_brands: isomiso2
    title           : AxelF
    encoder         : Lavf58.29.100
    comment         : by www.OnlineMusicRecorder.com
    genre           : Blues
  Duration: 00:01:00.02, start: 0.000000, bitrate: 131 kb/s
    Stream #1:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 130 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:1 -> #0:0 (aac (native) -> aac (native))
  Stream #1:0 -> #0:1 (aac (native) -> aac (native))
  Stream #0:0 -> #0:2 (h264 (native) -> h264 (libx264))
  Stream #0:0 -> #0:3 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[h264 @ 0x5562fa460400] Reinit context to 1920x1088, pix_fmt: yuv420p
[graph_0_in_0_1 @ 0x5562fab254c0] tb:1/48000 samplefmt:fltp
samplerate:48000 chlayout:0x3f
[graph_1_in_1_0 @ 0x5562fab5ac00] tb:1/44100 samplefmt:fltp
samplerate:44100 chlayout:0x3
[graph 2 input from stream 0:0 @ 0x5562fb0e2a00] w:1920 h:1080
pixfmt:yuv420p tb:1/12288 fr:24/1 sar:1/1
[scaler_out_0_2 @ 0x5562fb0e3080] w:1920 h:1080 flags:'bicubic' interl:0
[scaler_out_0_2 @ 0x5562fb0e3080] w:1920 h:1080 fmt:yuv420p sar:1/1 ->
w:1920 h:1080 fmt:yuv420p sar:1/1 flags:0x4
[libx264 @ 0x5562fa469c80] using SAR=1/1
[libx264 @ 0x5562fa469c80] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0x5562fa469c80] ratecontrol_init: can't open stats file
Error initializing output stream 0:2 -- Error while opening encoder for
output stream #0:2 - maybe incorrect parameters such as bit_rate, rate,
width or height
[aac @ 0x5562fa46c480] Qavg: 1508.763
[aac @ 0x5562fa46c480] 2 frames left in the queue on closing
[aac @ 0x5562fa46b740] Qavg: -nan
[aac @ 0x5562fa46b740] 1 frames left in the queue on closing
[AVIOContext @ 0x5562fa40c540] Statistics: 136915 bytes read, 2 seeks
[AVIOContext @ 0x5562fa408f00] Statistics: 76751 bytes read, 2 seeks
Conversion failed!



On Sat, Mar 14, 2020 at 5:01 AM Carl Eugen Hoyos <[hidden email]> wrote:

> Am Sa., 14. März 2020 um 06:04 Uhr schrieb Jeff Langston <
> [hidden email]>:
>
> > I'm trying to sort out an issue  I've run into with ffmpeg on the cli and
> > was wondering if anyone might be able to help. I am trying to leverage 2
> > pass encoding as well as inputting additional audio tracks to generate
> > multiple output versions  (MPEG-DASH/HLS/MP4/MP3).
> >
> > During the 2nd pass I'm hitting an error `ratecontrol_init: can't open
> > stats file` The same command when done in a single pass seems to work ok
> > but yields larger rendered file sizes than what 2 pass encoding generates
> >
> > Would anyone have any idea if it should be expected to be able to
> leverage
> > 2 pass encoding in this fashion to support multiple audio inputs or if
> > there are changes I might need to make to the cli args ?
> >
> > Full commands and their output avail here https://pastebin.com/GDcAR1rV
>
> Please test current FFmpeg git head and provide all necessary information
> (like command line including complete, uncut console output) here on the
> mailing list, only use external resources for input files.
>
> And please try to simplify your example.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Carl Eugen Hoyos-2
Am Sa., 14. März 2020 um 20:09 Uhr schrieb Jeff Langston <[hidden email]>:

>
> Hi,
>
> Here's the input commands boiled down to the simplest reproducible
> versions.
>
> Here's links to the input files https://s3.amazonaws.com/Jlangston/bunny.mp4
> https://s3.amazonaws.com/Jlangston/track1.m4a
> Trying either without the 2nd audio input or without rendering multiple
> video versions with multiple audio tracks seems to work but the combination
> of multiple input audio tracks and multiple output versions is hitting.
> Which I am guessing might be around the usage of the -passlogfile option.
>
> [libx264 @ 0x5562fa469c80] ratecontrol_init: can't open stats file
> Error initializing output stream 0:2 -- Error while opening encoder for
> output stream #0:2 - maybe incorrect parameters such as bit_rate, rate,
> width or height
>
> If I leave out the -passlogfile option I get a message about failure to
> rename log file in pass1.
>
> [libx264 @ 0x5621f1bcdfc0] failed to rename "ffmpeg2pass-0.log.temp" to
> "ffmpeg2pass-0.log"
> [libx264 @ 0x5621f1bcdfc0] failed to rename "ffmpeg2pass-0.log.mbtree.temp"
> to "ffmpeg2pass-0.log.mbtree"
>
> Here's the commands and their outputs below. Thank you in advance for any
> assitance or guidance you might be able to provide as well as everyone's
> work on ffmpeg.
>
> Pass 1:
> ffmpeg \
> -i ./bunny.mp4 \
> -i ./track1.m4a \
> -loglevel debug -v verbose \
> -map 0:a \
> -metadata:s:a:0 language=en \
> -metadata:s:a:0 title=track_one \
> -map 1:a \
> -metadata:s:a:1 language=ch \
> -metadata:s:a:1 title=track_two \
> -f dash \
> -map 0:v:0 \
> -s:v:0 1920x1080 \
> -b:v:0 1460k \
> -passlogfile:0 1080p \
> -map 0:v:0 \
> -b:v:1 683k \
> -s:v:1 1280x720 \
> -passlogfile:1 720p \
> -c:v libx264 \
> -profile:v baseline \
> -movflags faststart \
> -r 30 \
> -seg_duration 4 \
> -single_file 1 \
> -hls_playlist 1 \
> -streaming 1 \
> -dash_segment_type mp4 \
> -pass 1 \
> -an \
> -f mp4 /dev/null
>
> Pass 2:
> ffmpeg -y \
> -i ./bunny.mp4 \
> -i ./track1.m4a \
> -loglevel debug -v verbose \
> -map 0:a \
> -metadata:s:a:0 language=en \
> -metadata:s:a:0 title=track_two \
> -map 1:a \
> -metadata:s:a:1 language=ch \
> -metadata:s:a:1 title=track_one \
> -f dash \
> -map 0:v:0 \
> -s:v:0 1920x1080 \
> -b:v:0 1460k \
> -passlogfile:0 1080p \
> -map 0:v:0 \
> -b:v:1 683k \
> -s:v:1 1280x720 \
> -passlogfile:1 720p \
> -profile:v baseline \
> -movflags faststart \
> -r 30 \
> -seg_duration 4 \
> -single_file 1 \
> -hls_playlist 1 \
> -streaming 1 \
> -dash_segment_type mp4 \
> -pass 2 ./out/out.mpd

I don't know if this is the issue here (or if dash simply doesn't
forward the passlogfile
name to x264) but in general you cannot do this, you have to use the same output
format and especially the same audio for pass one and two. The reason is that
ffmpeg (the application) may duplicate (or drop) frames to keep a/v sync and if
you use different audio (like audio and no audio) for pass one and
two, the different
sync will completely brake two-pass encoding.

The problem gets worse by the fact that in general, neither ffmpeg nor x264 can
detect that you are using different settings for the two passes (x264 sometimes
crashes if the passes do not fit, I always wondered if this isn't a good thing).

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Reindl Harald


Am 14.03.20 um 21:06 schrieb Carl Eugen Hoyos:
> name to x264) but in general you cannot do this, you have to use the same output
> format and especially the same audio for pass one and two. The reason is that
> ffmpeg (the application) may duplicate (or drop) frames to keep a/v sync and if
> you use different audio (like audio and no audio) for pass one and
> two, the different
> sync will completely brake two-pass encoding.

simply no - using "-an" here for 10 years now *always* for the first pass
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Jeff Langston
Right -an in the first pass is referenced in the docs "On pass 1, you may
just deactivate audio and set output to null"

Which looking closer at the docs and some further experimentation I was
able to sort out my issue. I didn't realize the -pass argument also took a
stream specifier which was what I needed. To add additional -pass:0 1
-pass:1 1 and -pass:0 2
 -pass:1 2 etc as arguments to include the stream specifier in the pass
arguments for each of the different mappings / outputs I was looking to
generate. Oddly it's working without that and multiple -passlogfile
references when I am not including multiple audio tracks but I'm relieved I
was able to sort this out and thank you all for taking the time to look at
my issue and hopefully this will would be able to help anyone else if they
were trying to do the same thing.

Thanks again to all who contribute to ffmpeg and associated tools so
useful.


On Sat, Mar 14, 2020 at 3:07 PM Reindl Harald <[hidden email]>
wrote:

>
>
> Am 14.03.20 um 21:06 schrieb Carl Eugen Hoyos:
> > name to x264) but in general you cannot do this, you have to use the
> same output
> > format and especially the same audio for pass one and two. The reason is
> that
> > ffmpeg (the application) may duplicate (or drop) frames to keep a/v sync
> and if
> > you use different audio (like audio and no audio) for pass one and
> > two, the different
> > sync will completely brake two-pass encoding.
>
> simply no - using "-an" here for 10 years now *always* for the first pass
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Carl Eugen Hoyos-2
Am Sa., 14. März 2020 um 22:53 Uhr schrieb Jeff Langston <[hidden email]>:

> Right -an in the first pass is referenced in the docs "On pass 1, you may
> just deactivate audio and set output to null"

Let me repeat:
The problem is not only that you get a completely broken encode (wrong
frames get higher bitrates) but that neither ffmpeg nor x264 can realize
that there is an issue (at least not before encoding ends). Note that
while the issue does not appear on every encode, it happens particularly
often with mov and mp4 output. It should not happen with mkv output.

The issue cannot happen with MEncoder and avi output which was the
likely original source of all two-pass documentation.

Please remember that top-posting is not welcome here, Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Error ‘can’t open stats file’ using 2 pass encoding with multiple audio inputs

Carl Eugen Hoyos-2
In reply to this post by Carl Eugen Hoyos-2
Am Sa., 14. März 2020 um 21:06 Uhr schrieb Carl Eugen Hoyos
<[hidden email]>:

> The problem gets worse by the fact that in general, neither ffmpeg nor x264 can
> detect that you are using different settings for the two passes (x264 sometimes
> crashes if the passes do not fit, I always wondered if this isn't a good thing).

The crash - that gives you a chance to realize the encoding quality is bad -
is described in issue 2846.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".