Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#4780 closed defect (invalid)

FFMpeg ignores the logfile of first pass when encoding through libxvid

Reported by: academic Owned by:
Priority: important Component: undetermined
Version: git-master Keywords: passlogfile libxvid regression
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: FFMpeg ignores the logfile of first pass when encoding through libxvid. As a result, FFMpeg uses lower quants and bitrate is higher, than it was set.
How to reproduce: The structure of my command line has been around the following:

"ffmpeg.exe" -i "VTS_01_1" -vf pp=l5,crop=700:460:10:58,hqdn3d,scale=720:448 -tag:v XVID -c:v libxvid -b:v 1700k -g 250 -mbd rd -me_method full -flags +mv4+aic+cgop -trellis 2 -bf 1 -ssim avg -passlogfile "log.pass" -pass 1 -c:a copy "test.avi"

"ffmpeg.exe" -i "VTS_01_1" -vf pp=l5,crop=700:460:10:58,hqdn3d,scale=720:448 -tag:v XVID -c:v libxvid -b:v 1700k -g 250 -mbd rd -me_method full -flags +mv4+aic+cgop -trellis 2 -bf 1 -ssim avg -passlogfile "log.pass" -pass 2 -c:a copy "test.avi"

for sample you can add -t 00:01:01

The specified version or higher had such an anomaly that became established file type xvidff.iG2Kb7, which is the version where everything is working correctly (ffmpeg version N-74131-g9ec17e4), not created. Logs of FFMpeg in attachment.

ffmpeg version: ffmpeg version N-74179-g9dcaae7 or higher
built on: built with gcc 4.9.3 (GCC)

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (3)

work.log (235.4 KB) - added by academic 4 years ago.
not_work.log (237.0 KB) - added by academic 4 years ago.
2ndpass_xvid.zip (113.3 KB) - added by academic 4 years ago.

Download all attachments as: .zip

Change History (17)

Changed 4 years ago by academic

Changed 4 years ago by academic

comment:1 Changed 4 years ago by cehoyos

  • Component changed from ffmpeg to undetermined
  • Keywords passlogfile libxvid regression added
  • Priority changed from normal to important

I tested the following:

$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -pass 1 -passlogfile log.pass -t 60 -y out1.avi
$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -pass 2 -passlogfile log.pass -t 60 -y out1.avi
$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 200k -pass 1 -passlogfile log.pass -t 60 -y out2.avi
$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 200k -pass 2 -passlogfile log.pass -t 60 -y out2.avi

The output files have different size, the size changes when I empty the log file (that is present) between first and second pass, so I don't think the log file is ignored. What do I miss?

If this is a regression, please point us to the exact change introducing the issue.

comment:2 follow-up: Changed 4 years ago by academic

My English is pretty bad, but if we have such command lines:

$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 1 -passlogfile log.pass -t 600 -y out1.avi
$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 2 -passlogfile log.pass -t 600 -y out1.avi

we get on ffmpeg version N-74131-g9ec17e4 bitrate 88k, which is correct, but on ffmpeg version N-74179-g9dcaae7 or higher we get bitrate 153k. I also can see, that FFMpeg opens a log file and reads it to the end in two theese versions. But in new versions bitrate is significantly higher than what we have specified.

Last edited 4 years ago by academic (previous) (diff)

comment:3 in reply to: ↑ 2 Changed 4 years ago by cehoyos

Replying to academic:

we get on ffmpeg version N-74131-g9ec17e4 bitrate 88k, which is correct, but on ffmpeg version N-74179-g9dcaae7 or higher we get bitrate 153k.

Not reproducible here with 9dcaae7:

$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 1 -passlogfile log.pass -t 600 -y out1.avi
ffmpeg version N-74179-g9dcaae7 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libxvid
  libavutil      54. 29.100 / 54. 29.100
  libavcodec     56. 56.101 / 56. 56.101
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 30.100 /  5. 30.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'out1.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, pass 1, 80 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.56.101 libxvid
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help
frame=15000 fps=1339 q=2.0 Lsize=   12452kB time=00:10:00.00 bitrate= 170.0kbits/s
video:12087kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.017452%
$ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 2 -passlogfile log.pass -t 600 -y out1.avi
ffmpeg version N-74179-g9dcaae7 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --enable-libxvid
  libavutil      54. 29.100 / 54. 29.100
  libavcodec     56. 56.101 / 56. 56.101
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 30.100 /  5. 30.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'out1.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, pass 2, 80 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.56.101 libxvid
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help
frame=15000 fps=1343 q=5.0 Lsize=    6475kB time=00:10:00.00 bitrate=  88.4kbits/s
video:6110kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 5.965364%

comment:4 Changed 4 years ago by academic

Yes, I see the result. This is very strange, because I have two computers, the situation is the same. Could this mean that in the FFMpeg for Windows somehow changed initialize variables or not? I mentioned about the file that appears when you use the latest versions of the current directory. Previously, it had never been. And when it does not, then all is well. And when it is, then all bad. But I looked at the folder Temp, and there they are, only without the CRC. Maybe there were problems with the initialization of variables in Windows? And it does not apply to XviD? This code changes can be tracked? Tomorrow I will repeat the experiment at work on the latest version and give the log. But, apparently, the problem lies elsewhere.

comment:5 Changed 4 years ago by academic

On Windows all is the same :-(
The 1st pass:

d:\Sharing\Rip\Test_FFMpeg>"d:\portableapps\FFMpeg\bin\ffmpeg.exe" -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 1 -passlogfile "d:\Sharing\Rip\Test_FFMpeg\log.pass" -t 600 -y "d:\Sharing\Rip\Test_FFMpeg\out1.avi"
ffmpeg version N-74600-g1bf76cd Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 58.100 / 56. 58.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 37.100 /  5. 37.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1
 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'd:\Sharing\Rip\Test_FFMpeg\out1.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 320x240 [S
AR 1:1 DAR 4:3], q=2-31, pass 1, 80 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.58.100 libxvid
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help

frame=15000 fps=440 q=2.0 Lsize=   12452kB time=00:10:00.00 bitrate= 170.0kbits/s
video:12087kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
 overhead: 3.017452%

And the 2nd pass:

d:\Sharing\Rip\Test_FFMpeg>"d:\portableapps\FFMpeg\bin\ffmpeg.exe" -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 2 -passlogfile "d:\Sharing\Rip\Test_FFMpeg\log.pass" -t 600 -y "d:\Sharing\Rip\Test_FFMpeg\out1.avi"
ffmpeg version N-74600-g1bf76cd Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-l
ibilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --en
able-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --ena
ble-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
 --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enabl
e-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --ena
ble-decklink --enable-zlib
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 58.100 / 56. 58.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 37.100 /  5. 37.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1
 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'd:\Sharing\Rip\Test_FFMpeg\out1.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 320x240 [S
AR 1:1 DAR 4:3], q=2-31, pass 2, 80 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.58.100 libxvid
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help
frame=15000 fps=444 q=2.0 Lsize=   11235kB time=00:10:00.00 bitrate= 153.4kbits/s
video:10870kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
 overhead: 3.353590%

And in current directory FFMpeg in creating file xvidff.iG2Kb7 during the 2nd pass.

comment:6 follow-up: Changed 4 years ago by cehoyos

Are you using the Zeranoe binary?

comment:7 in reply to: ↑ 6 Changed 4 years ago by academic

Replying to cehoyos:

Are you using the Zeranoe binary?

Yes, from ffmpeg.zeranoe.com. I'm using 32-bit version binaries, because sometimes I make encoding through AviSynth? scripts.

comment:8 Changed 4 years ago by cehoyos

Did you try to compile yourself?
Please report this issue to Zeranoe, the FFmpeg project only provides source code.

comment:9 Changed 4 years ago by Timothy_Gu

It works fine here using http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20150825-git-4c39892-win32-static.7z

C:\Users\tiancheng.gu\test-xvid
λ dir
 Volume in drive C has no label.
 Volume Serial Number is FE12-15F1

 Directory of C:\Users\tiancheng.gu\test-xvid

08/26/2015  09:52 AM    <DIR>          .
08/26/2015  09:52 AM    <DIR>          ..
               0 File(s)              0 bytes
               2 Dir(s)  75,032,383,488 bytes free

C:\Users\tiancheng.gu\test-xvid
λ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 1 -passlogfile a.log -t 600 -y a.avi
ffmpeg version N-74645-g4c39892 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 58.100 / 56. 58.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 37.100 /  5. 37.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'a.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, pass 1, 80 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.58.100 libxvid
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help
frame=15000 fps=1013 q=2.0 Lsize=   12452kB time=00:10:00.00 bitrate= 170.0kbits/s
video:12087kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.017452%

C:\Users\tiancheng.gu\test-xvid
λ ffmpeg -f lavfi -i testsrc -vcodec libxvid -vb 80k -g 250 -pass 2 -passlogfile a.log -t 600 -y a.avi
ffmpeg version N-74645-g4c39892 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 58.100 / 56. 58.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 37.100 /  5. 37.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, avi, to 'a.avi':
  Metadata:
    ISFT            : Lavf56.40.101
    Stream #0:0: Video: mpeg4 (libxvid) (xvid / 0x64697678), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=2-31, pass 2, 80 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc56.58.100 libxvid
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (libxvid))
Press [q] to stop, [?] for help
frame=15000 fps=999 q=2.0 Lsize=   11235kB time=00:10:00.00 bitrate= 153.4kbits/s
video:10870kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.353590%

C:\Users\tiancheng.gu\test-xvid
λ dir
 Volume in drive C has no label.
 Volume Serial Number is FE12-15F1

 Directory of C:\Users\tiancheng.gu\test-xvid

08/26/2015  09:53 AM    <DIR>          .
08/26/2015  09:53 AM    <DIR>          ..
08/26/2015  09:53 AM        11,504,468 a.avi
08/26/2015  09:52 AM           315,805 a.log-0.log
               2 File(s)     11,820,273 bytes
               2 Dir(s)  75,020,333,056 bytes free                                                        

comment:10 follow-up: Changed 4 years ago by cehoyos

Did you report the issue to Zeranoe?

comment:11 in reply to: ↑ 10 Changed 4 years ago by academic

Replying to cehoyos:

Did you report the issue to Zeranoe?

I informed him about this topic via the feedback form on the site, but received no reply. The problem in version N-74961-g61009a7 remained.

Last edited 4 years ago by academic (previous) (diff)

comment:12 Changed 4 years ago by cehoyos

  • Resolution set to invalid
  • Status changed from new to closed

If you have forwarded the issue to him, this ticket can be closed, thank you.

comment:13 follow-up: Changed 4 years ago by cehoyos

This may have been fixed in 9d4ab1380addb2a4e2863c625a63eed16009f90c

Changed 4 years ago by academic

comment:14 in reply to: ↑ 13 Changed 4 years ago by academic

Replying to cehoyos:

This may have been fixed in 9d4ab1380addb2a4e2863c625a63eed16009f90c

I do not confirm it. The bug is still present. The only difference is that a temporary file xvidff.iG2Kb7 no longer deleted, and the contents of the file is fully consistent with the first pass log. Tested on ffmpeg version N-79083-gc411e90 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 5.3.0 (GCC) dated 19 March. I attached log with trace option in attachment and also other files except vedeo.

Note: See TracTickets for help on using tickets.