[FFmpeg-trac] #2015(avfilter:closed): VF Scale option should include -2 to create square pixels

FFmpeg trac at avcodec.org
Sun Jan 6 19:37:20 CET 2013


#2015: VF Scale option should include -2 to create square pixels
-------------------------------------+-------------------------------------
             Reporter:  ramitbhalla  |                    Owner:
                 Type:  enhancement  |                   Status:  closed
             Priority:  normal       |                Component:  avfilter
              Version:  unspecified  |               Resolution:
             Keywords:  scale        |  needs_more_info
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by ramitbhalla):

 I'm attaching the error below with the output.

 In addition to the -2 option for which Mencoder creates square pixels
 there is another option -10 which creates pixels that allow it to be
 divisible by 16. This is VERY important for quicktime codecs.

 I would request 2 options be created for the scale filter:
 a. -2 which creates square pixels
 b. -10 which creates pixels divisible by 16 (for quicktime)

 You can change the -2 and -10 to someelse if you'd like, I was just
 suggested to keep it similar to MEncoder options, but thats your choice,
 the functionality is more important.

 Here is the error output created because of non square pixels with the -1
 option:

 {{{
 ffmpeg.2311.exe -y -threads 0 -i "..\NCIS HD Small.wtv" -vf scale=720:-1
 -vcodec libxvid -acodec copy test-csi.ts

 ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg
 developers
   built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
   configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-
 prefix=/home/rdp/dev/ffmpeg-windows-build-helper
 s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config
 --enable-gpl --enable-libx264 --enable-avisynth -
 -enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib
 --enable-librtmp --enable-libvorbis --enable-libtheo
 ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm
 --enable-libfreetype --enable-fontconfig --ena
 ble-libass --enable-libutvideo --enable-libopus --disable-w32threads
 --enable-frei0r --enable-filter=frei0r --enable-lib
 vo-aacenc --enable-bzlib --enable-libxavs --extra-
 cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
 ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-
 libbluray --enable-libvpx --enable-runtime-cpudetect

   libavutil      52. 12.100 / 52. 12.100
   libavcodec     54. 81.100 / 54. 81.100
   libavformat    54. 49.102 / 54. 49.102
   libavdevice    54.  3.102 / 54.  3.102
   libavfilter     3. 29.100 /  3. 29.100
   libswscale      2.  1.103 /  2.  1.103
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 [wtv @ 01edc9e0] reported file length (0x15b2b2fd0) exceeds number of
 available sectors (0xb0000000)
 [mpeg2video @ 01edf0e0] mpeg_decode_postinit() failure
     Last message repeated 10 times
 Input #0, wtv, from '..\NCIS HD Small.wtv':
   Metadata:
     WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
     WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
     Title           : NCIS: Los Angeles
     WM/SubTitle     : Sacrifice
     WM/SubTitleDescription: The LAPD asks NCIS for help when a case
 exposes a link between a Mexican drug cartel and a t
 errorist.
     genre           : Drama;General;Series;Action/Adventure
     WM/OriginalReleaseTime: 0
     WM/MediaCredits : Chris O'Donnell/LL Cool J/Linda Hunt/Daniela
 Ruah/Eric Christian Olsen/Barrett Foa/Renée Felice S
 mith;John P. Kousakis;;America Olivo/Brant Cotton/Doug Rao/Danny
 Nucci/Gino Montesinos/Farshad Farahat/Carlos Arellano/C
 heryl Texiera/Brian Michael Jones/Jen
     service_provider: KPHODT
     service_name    : KPHODT (KPHO-DT)
     WM/MediaNetworkAffiliation: CBS Affiliate
     WM/MediaOriginalChannel: 5
     WM/MediaOriginalChannelSubNumber: 1
     WM/MediaOriginalBroadcastDateTime: 2011-10-18T07:00:00Z
     WM/MediaOriginalRunTime: 38375940244
     WM/MediaIsStereo: true
     WM/MediaIsRepeat: false
     WM/MediaIsLive  : false
     WM/MediaIsTape  : false
     WM/MediaIsDelay : false
     WM/MediaIsSubtitled: false
     WM/MediaIsMovie : false
     WM/MediaIsPremiere: false
     WM/MediaIsFinale: false
     WM/MediaIsSAP   : false
     WM/MediaIsSport : false
     WM/ParentalRating: TV-14
     WM/Provider     : MediaCenterDefault
     WM/VideoClosedCaptioning: true
     WM/WMRVEncodeTime: 2011-10-19 03:00:02
     WM/WMRVSeriesUID: !MCSeries!01158361
     WM/WMRVServiceID: !MCService!28455624
     WM/WMRVProgramID: !MCProgram!264522248
     WM/WMRVRequestID: 0
     WM/WMRVScheduleItemID: 0
     WM/WMRVQuality  : 3
     WM/WMRVOriginalSoftPrePadding: 420
     WM/WMRVOriginalSoftPostPadding: 180
     WM/WMRVHardPrePadding: -300
     WM/WMRVHardPostPadding: 0
     WM/WMRVATSCContent: true
     WM/WMRVDTVContent: true
     WM/WMRVHDContent: true
     Duration        : 36582312388
     WM/WMRVEndTime  : 2011-10-19 04:01:00
     WM/WMRVBitrate  : 12.738619
     WM/WMRVKeepUntil: 0
     WM/WMRVActualSoftPrePadding: 297
     WM/WMRVActualSoftPostPadding: 0
     WM/WMRVContentProtected: false
     WM/WMRVContentProtectedPercent: 0
     WM/WMRVExpirationSpan: 9223372036854775807
     WM/WMRVInBandRatingSystem: 255
     WM/WMRVInBandRatingLevel: 255
     WM/WMRVInBandRatingAttributes: 0
     WM/WMRVWatched  : false
     WM/MediaThumbWidth: 352
     WM/MediaThumbHeight: 198
     WM/MediaThumbStride: 1056
     WM/MediaThumbRet: 0
     WM/MediaThumbRatingSystem: 255
     WM/MediaThumbRatingLevel: 255
     WM/MediaThumbRatingAttributes: 0
     WM/MediaThumbAspectRatioX: 16
     WM/MediaThumbAspectRatioY: 9
     WM/MediaThumbTimeStamp: 4634350287386204132
   Duration: 00:31:59.53, start: 1.797444, bitrate: 874 kb/s
     Stream #0:0[0xe](eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
     Stream #0:1[0xf](eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
     Stream #0:2[0x10]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR
 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 10000k tbn
 , 59.94 tbc
     Stream #0:3[0x11]: Subtitle: eia_608
     Stream #0:4[0x0]: Attachment: mjpeg
     Metadata:
       title           : TV Thumbnail
 [libxvid @ 0365d020] Xvid: Could not create encoder reference
 Output #0, mpegts, to 'test-csi.ts':
   Metadata:
     WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
     WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
     Title           : NCIS: Los Angeles
     WM/SubTitle     : Sacrifice
     WM/SubTitleDescription: The LAPD asks NCIS for help when a case
 exposes a link between a Mexican drug cartel and a t
 errorist.
     genre           : Drama;General;Series;Action/Adventure
     WM/OriginalReleaseTime: 0
     WM/MediaCredits : Chris O'Donnell/LL Cool J/Linda Hunt/Daniela
 Ruah/Eric Christian Olsen/Barrett Foa/Renée Felice S
 mith;John P. Kousakis;;America Olivo/Brant Cotton/Doug Rao/Danny
 Nucci/Gino Montesinos/Farshad Farahat/Carlos Arellano/C
 heryl Texiera/Brian Michael Jones/Jen
     service_provider: KPHODT
     service_name    : KPHODT (KPHO-DT)
     WM/MediaNetworkAffiliation: CBS Affiliate
     WM/MediaOriginalChannel: 5
     WM/MediaOriginalChannelSubNumber: 1
     WM/MediaOriginalBroadcastDateTime: 2011-10-18T07:00:00Z
     WM/MediaOriginalRunTime: 38375940244
     WM/MediaIsStereo: true
     WM/MediaIsRepeat: false
     WM/MediaIsLive  : false
     WM/MediaIsTape  : false
     WM/MediaIsDelay : false
     WM/MediaIsSubtitled: false
     WM/MediaIsMovie : false
     WM/MediaIsPremiere: false
     WM/MediaIsFinale: false
     WM/MediaIsSAP   : false
     WM/MediaIsSport : false
     WM/ParentalRating: TV-14
     WM/Provider     : MediaCenterDefault
     WM/VideoClosedCaptioning: true
     WM/WMRVEncodeTime: 2011-10-19 03:00:02
     WM/WMRVSeriesUID: !MCSeries!01158361
     WM/WMRVServiceID: !MCService!28455624
     WM/WMRVProgramID: !MCProgram!264522248
     WM/WMRVRequestID: 0
     WM/WMRVScheduleItemID: 0
     WM/WMRVQuality  : 3
     WM/WMRVOriginalSoftPrePadding: 420
     WM/WMRVOriginalSoftPostPadding: 180
     WM/WMRVHardPrePadding: -300
     WM/WMRVHardPostPadding: 0
     WM/WMRVATSCContent: true
     WM/WMRVDTVContent: true
     WM/WMRVHDContent: true
     Duration        : 36582312388
     WM/WMRVEndTime  : 2011-10-19 04:01:00
     WM/WMRVBitrate  : 12.738619
     WM/WMRVKeepUntil: 0
     WM/WMRVActualSoftPrePadding: 297
     WM/WMRVActualSoftPostPadding: 0
     WM/WMRVContentProtected: false
     WM/WMRVContentProtectedPercent: 0
     WM/WMRVExpirationSpan: 9223372036854775807
     WM/WMRVInBandRatingSystem: 255
     WM/WMRVInBandRatingLevel: 255
     WM/WMRVInBandRatingAttributes: 0
     WM/WMRVWatched  : false
     WM/MediaThumbWidth: 352
     WM/MediaThumbHeight: 198
     WM/MediaThumbStride: 1056
     WM/MediaThumbRet: 0
     WM/MediaThumbRatingSystem: 255
     WM/MediaThumbRatingLevel: 255
     WM/MediaThumbRatingAttributes: 0
     WM/MediaThumbAspectRatioX: 16
     WM/MediaThumbAspectRatioY: 9
     WM/MediaThumbTimeStamp: 4634350287386204132
     Stream #0:0: Video: mpeg4 (xvid / 0x64697678), yuv420p, 720x405 [SAR
 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 29.97
  tbc
     Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), 384 kb/s
 Stream mapping:
   Stream #0:2 -> #0:0 (mpeg2video -> libxvid)
   Stream #0:0 -> #0:1 (copy)
 Error while opening encoder for output stream #0:0 - maybe incorrect
 parameters such as bit_rate, rate, width or height
 }}}

 Here is the output with Square Pixels (ie.e divisible by 0x2)

 {{{
 ffmpeg.2311.exe -y -threads 0 -i "..\NCIS HD Small.wtv" -vf scale=720:400
 -vcodec libxvid -acodec copy test-csi.ts

 ffmpeg version N-48065-g6375318 Copyright (c) 2000-2012 the FFmpeg
 developers
   built on Dec 21 2012 09:06:30 with gcc 4.7.2 (GCC)
   configuration: --enable-static --arch=x86 --target-os=mingw32 --cross-
 prefix=/home/rdp/dev/ffmpeg-windows-build-helper
 s/sandbox/mingw-w64-i686/bin/i686-w64-mingw32- --pkg-config=pkg-config
 --enable-gpl --enable-libx264 --enable-avisynth -
 -enable-libxvid --enable-libmp3lame --enable-version3 --enable-zlib
 --enable-librtmp --enable-libvorbis --enable-libtheo
 ra --enable-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm
 --enable-libfreetype --enable-fontconfig --ena
 ble-libass --enable-libutvideo --enable-libopus --disable-w32threads
 --enable-frei0r --enable-filter=frei0r --enable-lib
 vo-aacenc --enable-bzlib --enable-libxavs --extra-
 cflags=-DPTW32_STATIC_LIB --enable-libopencore-amrnb --enable-libopenc
 ore-amrwb --enable-libvo-amrwbenc --enable-libschroedinger --enable-
 libbluray --enable-libvpx --enable-runtime-cpudetect

   libavutil      52. 12.100 / 52. 12.100
   libavcodec     54. 81.100 / 54. 81.100
   libavformat    54. 49.102 / 54. 49.102
   libavdevice    54.  3.102 / 54.  3.102
   libavfilter     3. 29.100 /  3. 29.100
   libswscale      2.  1.103 /  2.  1.103
   libswresample   0. 17.102 /  0. 17.102
   libpostproc    52.  2.100 / 52.  2.100
 [wtv @ 01eac9e0] reported file length (0x15b2b2fd0) exceeds number of
 available sectors (0xb0000000)
 [mpeg2video @ 01eaf0e0] mpeg_decode_postinit() failure
     Last message repeated 10 times
 Input #0, wtv, from '..\NCIS HD Small.wtv':
   Metadata:
     WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
     WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
     Title           : NCIS: Los Angeles
     WM/SubTitle     : Sacrifice
     WM/SubTitleDescription: The LAPD asks NCIS for help when a case
 exposes a link between a Mexican drug cartel and a t
 errorist.
     genre           : Drama;General;Series;Action/Adventure
     WM/OriginalReleaseTime: 0
     WM/MediaCredits : Chris O'Donnell/LL Cool J/Linda Hunt/Daniela
 Ruah/Eric Christian Olsen/Barrett Foa/Renée Felice S
 mith;John P. Kousakis;;America Olivo/Brant Cotton/Doug Rao/Danny
 Nucci/Gino Montesinos/Farshad Farahat/Carlos Arellano/C
 heryl Texiera/Brian Michael Jones/Jen
     service_provider: KPHODT
     service_name    : KPHODT (KPHO-DT)
     WM/MediaNetworkAffiliation: CBS Affiliate
     WM/MediaOriginalChannel: 5
     WM/MediaOriginalChannelSubNumber: 1
     WM/MediaOriginalBroadcastDateTime: 2011-10-18T07:00:00Z
     WM/MediaOriginalRunTime: 38375940244
     WM/MediaIsStereo: true
     WM/MediaIsRepeat: false
     WM/MediaIsLive  : false
     WM/MediaIsTape  : false
     WM/MediaIsDelay : false
     WM/MediaIsSubtitled: false
     WM/MediaIsMovie : false
     WM/MediaIsPremiere: false
     WM/MediaIsFinale: false
     WM/MediaIsSAP   : false
     WM/MediaIsSport : false
     WM/ParentalRating: TV-14
     WM/Provider     : MediaCenterDefault
     WM/VideoClosedCaptioning: true
     WM/WMRVEncodeTime: 2011-10-19 03:00:02
     WM/WMRVSeriesUID: !MCSeries!01158361
     WM/WMRVServiceID: !MCService!28455624
     WM/WMRVProgramID: !MCProgram!264522248
     WM/WMRVRequestID: 0
     WM/WMRVScheduleItemID: 0
     WM/WMRVQuality  : 3
     WM/WMRVOriginalSoftPrePadding: 420
     WM/WMRVOriginalSoftPostPadding: 180
     WM/WMRVHardPrePadding: -300
     WM/WMRVHardPostPadding: 0
     WM/WMRVATSCContent: true
     WM/WMRVDTVContent: true
     WM/WMRVHDContent: true
     Duration        : 36582312388
     WM/WMRVEndTime  : 2011-10-19 04:01:00
     WM/WMRVBitrate  : 12.738619
     WM/WMRVKeepUntil: 0
     WM/WMRVActualSoftPrePadding: 297
     WM/WMRVActualSoftPostPadding: 0
     WM/WMRVContentProtected: false
     WM/WMRVContentProtectedPercent: 0
     WM/WMRVExpirationSpan: 9223372036854775807
     WM/WMRVInBandRatingSystem: 255
     WM/WMRVInBandRatingLevel: 255
     WM/WMRVInBandRatingAttributes: 0
     WM/WMRVWatched  : false
     WM/MediaThumbWidth: 352
     WM/MediaThumbHeight: 198
     WM/MediaThumbStride: 1056
     WM/MediaThumbRet: 0
     WM/MediaThumbRatingSystem: 255
     WM/MediaThumbRatingLevel: 255
     WM/MediaThumbRatingAttributes: 0
     WM/MediaThumbAspectRatioX: 16
     WM/MediaThumbAspectRatioY: 9
     WM/MediaThumbTimeStamp: 4634350287386204132
   Duration: 00:31:59.53, start: 1.797444, bitrate: 874 kb/s
     Stream #0:0[0xe](eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s
     Stream #0:1[0xf](eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s
     Stream #0:2[0x10]: Video: mpeg2video (Main), yuv420p, 1920x1080 [SAR
 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 10000k tbn
 , 59.94 tbc
     Stream #0:3[0x11]: Subtitle: eia_608
     Stream #0:4[0x0]: Attachment: mjpeg
     Metadata:
       title           : TV Thumbnail
 Output #0, mpegts, to 'test-csi.ts':
   Metadata:
     WM/MediaClassPrimaryID: db9830bd-3ab3-4fab-8a371a995f7ff74
     WM/MediaClassSecondaryID: ba7f258a-62f7-47a9-b21f4651c42a000
     Title           : NCIS: Los Angeles
     WM/SubTitle     : Sacrifice
     WM/SubTitleDescription: The LAPD asks NCIS for help when a case
 exposes a link between a Mexican drug cartel and a t
 errorist.
     genre           : Drama;General;Series;Action/Adventure
     WM/OriginalReleaseTime: 0
     WM/MediaCredits : Chris O'Donnell/LL Cool J/Linda Hunt/Daniela
 Ruah/Eric Christian Olsen/Barrett Foa/Renée Felice S
 mith;John P. Kousakis;;America Olivo/Brant Cotton/Doug Rao/Danny
 Nucci/Gino Montesinos/Farshad Farahat/Carlos Arellano/C
 heryl Texiera/Brian Michael Jones/Jen
     service_provider: KPHODT
     service_name    : KPHODT (KPHO-DT)
     WM/MediaNetworkAffiliation: CBS Affiliate
     WM/MediaOriginalChannel: 5
     WM/MediaOriginalChannelSubNumber: 1
     WM/MediaOriginalBroadcastDateTime: 2011-10-18T07:00:00Z
     WM/MediaOriginalRunTime: 38375940244
     WM/MediaIsStereo: true
     WM/MediaIsRepeat: false
     WM/MediaIsLive  : false
     WM/MediaIsTape  : false
     WM/MediaIsDelay : false
     WM/MediaIsSubtitled: false
     WM/MediaIsMovie : false
     WM/MediaIsPremiere: false
     WM/MediaIsFinale: false
     WM/MediaIsSAP   : false
     WM/MediaIsSport : false
     WM/ParentalRating: TV-14
     WM/Provider     : MediaCenterDefault
     WM/VideoClosedCaptioning: true
     WM/WMRVEncodeTime: 2011-10-19 03:00:02
     WM/WMRVSeriesUID: !MCSeries!01158361
     WM/WMRVServiceID: !MCService!28455624
     WM/WMRVProgramID: !MCProgram!264522248
     WM/WMRVRequestID: 0
     WM/WMRVScheduleItemID: 0
     WM/WMRVQuality  : 3
     WM/WMRVOriginalSoftPrePadding: 420
     WM/WMRVOriginalSoftPostPadding: 180
     WM/WMRVHardPrePadding: -300
     WM/WMRVHardPostPadding: 0
     WM/WMRVATSCContent: true
     WM/WMRVDTVContent: true
     WM/WMRVHDContent: true
     Duration        : 36582312388
     WM/WMRVEndTime  : 2011-10-19 04:01:00
     WM/WMRVBitrate  : 12.738619
     WM/WMRVKeepUntil: 0
     WM/WMRVActualSoftPrePadding: 297
     WM/WMRVActualSoftPostPadding: 0
     WM/WMRVContentProtected: false
     WM/WMRVContentProtectedPercent: 0
     WM/WMRVExpirationSpan: 9223372036854775807
     WM/WMRVInBandRatingSystem: 255
     WM/WMRVInBandRatingLevel: 255
     WM/WMRVInBandRatingAttributes: 0
     WM/WMRVWatched  : false
     WM/MediaThumbWidth: 352
     WM/MediaThumbHeight: 198
     WM/MediaThumbStride: 1056
     WM/MediaThumbRet: 0
     WM/MediaThumbRatingSystem: 255
     WM/MediaThumbRatingLevel: 255
     WM/MediaThumbRatingAttributes: 0
     WM/MediaThumbAspectRatioX: 16
     WM/MediaThumbAspectRatioY: 9
     WM/MediaThumbTimeStamp: 4634350287386204132
     encoder         : Lavf54.49.102
     Stream #0:0: Video: mpeg4 (xvid / 0x64697678), yuv420p, 720x400 [SAR
 80:81 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 29.
 97 tbc
     Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), 384 kb/s
 Stream mapping:
   Stream #0:2 -> #0:0 (mpeg2video -> libxvid)
   Stream #0:0 -> #0:1 (copy)
 Press [q] to stop, [?] for help
 frame=  112 fps= 96 q=31.0 Lsize=     476kB time=00:00:03.73
 bitrate=1044.0kbits/s dup=34 drop=0
 video:273kB audio:144kB subtitle:0 global headers:0kB muxing overhead
 14.429182%
 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2015#comment:5>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list