Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#1523 closed enhancement (fixed)

automatic set a default -slices value for ffv1 version 3

Reported by: dericed Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords: ffv1, threads
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

If I encode to ffv1 version 3 without specifying a -slices value, then slices defaults to zero, which is not allowed, and thus the command fails. Because of this encoding with ffv1 version 3 does not seem to be possible without explicitly stating the slice count. I think most users may not be so picky about slice count and would accept a default value if they do not specify it. Can ffv1 version 3 default to a value for -slices based on detection number of (available) CPU cores.

How to reproduce:

ffmpeg started on 2012-07-10 at 21:06:53
Report written to "ffmpeg-20120710-210653.log"
Command line:
ffmpeg -report -y -f lavfi -t 1 -i testsrc -c:v ffv1 -strict experimental -level 3 out.mov
ffmpeg version 0.11.1.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul  3 2012 20:17:26 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --enable-libopenjpeg
  libavutil      51. 63.100 / 51. 63.100
  libavcodec     54. 32.100 / 54. 32.100
  libavformat    54. 14.100 / 54. 14.100
  libavdevice    54.  0.100 / 54.  0.100
  libavfilter     3.  0.101 /  3.  0.101
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[Parsed_testsrc_0 @ 0x7fef13418540] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[out @ 0x7fef13418a40] No opaque field provided
[lavfi @ 0x7fef1384e200] All info found
[lavfi @ 0x7fef1384e200] Estimating duration from bitrate, this may be inaccurate
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
-t is not an input option, keeping it for the next output; consider fixing your command line.
[buffer @ 0x7fef13419c00] Setting entry with key 'video_size' to value '320x240'
[buffer @ 0x7fef13419c00] Setting entry with key 'pix_fmt' to value '2'
[buffer @ 0x7fef13419c00] Setting entry with key 'time_base' to value '1/25'
[buffer @ 0x7fef13419c00] Setting entry with key 'pixel_aspect' to value '1/1'
[buffer @ 0x7fef13419c00] Setting entry with key 'sws_param' to value 'flags=2'
[buffer @ 0x7fef13419c00] Setting entry with key 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x7fef13419ca0] w:320 h:240 pixfmt:rgb24 tb:1/25 fr:25/1 sar:1/1 sws_param:flags=2
[output stream 0:0 @ 0x7fef13419ec0] No opaque field provided
[format @ 0x7fef1341a320] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0x7fef1341a680] w:320 h:240 fmt:rgb24 sar:1/1 -> w:320 h:240 fmt:bgr0 sar:1/1 flags:0x4
[ffv1 @ 0x7fef13854400] detected 2 logical cores
[ffv1 @ 0x7fef13854400] Unsupported number 0 of slices requested, please specify a supported number with -slices (ex:4,6,9,12,16, ...)
Output #0, mov, to 'out.mov':
    Stream #0:0, 0, 1/90000: Video: ffv1, bgr0, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> ffv1)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

Change History (5)

comment:1 Changed 4 years ago by cehoyos

Could you test current git head?

comment:2 Changed 4 years ago by cehoyos

I believe this was fixed yesterday, could you test again?
(I wasn't able to reproduce and therefore cannot test.)

comment:3 Changed 4 years ago by dericed

It worked.

Here's with no -slices expressed.

ffmpeg started on 2012-07-14 at 07:26:01
Report written to "ffmpeg-20120714-072601.log"
Command line:
ffmpeg -report -f lavfi -t 1 -i testsrc -c:v ffv1 -g 1 -level 3 -strict experimental -y out.mov
ffmpeg version 0.11.1.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 13 2012 22:09:29 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --enable-libopenjpeg
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 37.100 / 54. 37.100
  libavformat    54. 16.104 / 54. 16.104
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  2.100 /  3.  2.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[Parsed_testsrc_0 @ 0x7fdf5bc18560] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[lavfi @ 0x7fdf5c04e200] All info found
[lavfi @ 0x7fdf5c04e200] Estimating duration from bitrate, this may be inaccurate
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
-t is not an input option, keeping it for the next output; consider fixing your command line.
[buffer @ 0x7fdf5bc19c40] Setting entry with key 'video_size' to value '320x240'
[buffer @ 0x7fdf5bc19c40] Setting entry with key 'pix_fmt' to value '2'
[buffer @ 0x7fdf5bc19c40] Setting entry with key 'time_base' to value '1/25'
[buffer @ 0x7fdf5bc19c40] Setting entry with key 'pixel_aspect' to value '1/1'
[buffer @ 0x7fdf5bc19c40] Setting entry with key 'sws_param' to value 'flags=2'
[buffer @ 0x7fdf5bc19c40] Setting entry with key 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x7fdf5bc19d00] w:320 h:240 pixfmt:rgb24 tb:1/25 fr:25/1 sar:1/1 sws_param:flags=2
[format @ 0x7fdf5bc1a3a0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0x7fdf5bc1a720] w:320 h:240 fmt:rgb24 sar:1/1 -> w:320 h:240 fmt:bgr0 sar:1/1 flags:0x4
[ffv1 @ 0x7fdf5c054400] detected 2 logical cores
[mov @ 0x7fdf5c055000] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to 'out.mov':
  Metadata:
    encoder         : Lavf54.16.104
    Stream #0:0, 0, 1/25: Video: ffv1, bgr0, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> ffv1)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame=   25 fps=0.0 q=0.0 Lsize=     117kB time=00:00:01.00 bitrate= 956.6kbits/s    
video:116kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.693918%

and here's with a non-default slices expressed:

ffmpeg started on 2012-07-14 at 07:31:39
Report written to "ffmpeg-20120714-073139.log"
Command line:
ffmpeg -report -f lavfi -t 1 -i testsrc -c:v ffv1 -g 1 -level 3 -strict experimental -slices 12 -y out_12.mov
ffmpeg version 0.11.1.git Copyright (c) 2000-2012 the FFmpeg developers
  built on Jul 13 2012 22:09:29 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-libfreetype --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-librtmp --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-libvo-aacenc --enable-libopenjpeg
  libavutil      51. 64.100 / 51. 64.100
  libavcodec     54. 37.100 / 54. 37.100
  libavformat    54. 16.104 / 54. 16.104
  libavdevice    54.  1.100 / 54.  1.100
  libavfilter     3.  2.100 /  3.  2.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[Parsed_testsrc_0 @ 0x7f99e8c185a0] size:320x240 rate:25/1 duration:-1.000000 sar:1/1
[lavfi @ 0x7f99e904e200] All info found
[lavfi @ 0x7f99e904e200] Estimating duration from bitrate, this may be inaccurate
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
-t is not an input option, keeping it for the next output; consider fixing your command line.
[buffer @ 0x7f99e8c19d60] Setting entry with key 'video_size' to value '320x240'
[buffer @ 0x7f99e8c19d60] Setting entry with key 'pix_fmt' to value '2'
[buffer @ 0x7f99e8c19d60] Setting entry with key 'time_base' to value '1/25'
[buffer @ 0x7f99e8c19d60] Setting entry with key 'pixel_aspect' to value '1/1'
[buffer @ 0x7f99e8c19d60] Setting entry with key 'sws_param' to value 'flags=2'
[buffer @ 0x7f99e8c19d60] Setting entry with key 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x7f99e8c19e00] w:320 h:240 pixfmt:rgb24 tb:1/25 fr:25/1 sar:1/1 sws_param:flags=2
[format @ 0x7f99e8c1a460] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
[auto-inserted scaler 0 @ 0x7f99e8c1a7e0] w:320 h:240 fmt:rgb24 sar:1/1 -> w:320 h:240 fmt:bgr0 sar:1/1 flags:0x4
[ffv1 @ 0x7f99e9054400] detected 2 logical cores
[mov @ 0x7f99e9055000] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to 'out_12.mov':
  Metadata:
    encoder         : Lavf54.16.104
    Stream #0:0, 0, 1/25: Video: ffv1, bgr0, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo -> ffv1)
Press [q] to stop, [?] for help
No more output streams to write to, finishing.
frame=   25 fps=0.0 q=0.0 Lsize=     127kB time=00:00:01.00 bitrate=1041.0kbits/s    
video:126kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.637253%

However neither ffmpeg during encoding, nor ffprobe, could report on the slice count used. In order to verify the slice count of the encoding I used zzuf to corrupt the file and looked for the slices patterns during playback. I'll add another ticket to report on slices and version of ffv1 in ffprobe.

comment:4 Changed 4 years ago by cehoyos

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

Thank you for testing!

comment:5 Changed 4 years ago by cehoyos

  • Component changed from undetermined to avcodec
Note: See TracTickets for help on using tickets.