[FFmpeg-user] Help with -video_size

Tim Hiles thiles at confex.com
Fri Jan 6 10:14:31 EET 2017


Hi all,

I've tried recording my screen set at 1366 x 768 and specified -video_size
to 1024x768. The command did create a recording however it did not change
the size. The output is below (further comments after the output).

ffmpeg -rtbufsize 1000M -f dshow -i
video="screen-capture-recorder":audio="Interna
l Mic (IDT High Definiti" -flags +global_header -vcodec libx264 -pix_fmt
yuv420p -video_size 1024x768 -preset ultrafast
-acodec aac -ac 1 -ar 22050 "Sessiontest2.mp4"
ffmpeg version N-82966-g6993bb4 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable
-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-li
bbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --enable-libmodplug --enabl
e-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenh264 --enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable
-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-lzma --enable-decklink --enable-zl
ib
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
leaving aero onGuessed Channel Layout for Input Stream #0.1 : stereo
Input #0, dshow, from 'video=screen-capture-recorder:audio=Internal Mic
(IDT High Definiti':
  Duration: N/A, start: 40602.935000, bitrate: N/A
    Stream #0:0: Video: rawvideo, bgr0, 1366x768, 30 fps, 30 tbr, 10000k
tbn, 10000k tbc
    Stream #0:1: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
[libx264 @ 00000000005c6400] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX
[libx264 @ 00000000005c6400] profile Constrained Baseline, level 3.2
[libx264 @ 00000000005c6400] 264 - core 148 r2744 b97ae06 - H.264/MPEG-4
AVC codec - Copyleft 2003-2016 - http://www.vid
eolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0
me=dia subme=0 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_th
reads=2 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=0 intra_refresh=0 rc=crf mbtree=0 crf=23.0
qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq
=0
Output #0, mp4, to 'Sessiontest2.mp4':
  Metadata:
    encoder         : Lavf57.61.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p,
1366x768, q=-1--1, 30 fps, 10000k tbn, 30 tbc
    Metadata:
      encoder         : Lavc57.70.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 22050 Hz, mono,
fltp, 69 kb/s
    Metadata:
      encoder         : Lavc57.70.100 aac
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (pcm_s16le (native) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 00000000005e0fe0] Warning: data is not aligned! This can lead
to a speedloss
Past duration 0.937492 too large    4348kB time=00:00:51.53 bitrate=
691.1kbits/s speed=0.993x
frame=175139 fps= 30 q=-1.0 Lsize=  216992kB time=01:37:17.92 bitrate=
304.5kbits/s dup=15 drop=13 speed=   1x
video:165641kB audio:47853kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 1.638695%
[libx264 @ 00000000005c6400] frame I:701   Avg QP:10.05  size:209412
[libx264 @ 00000000005c6400] frame P:174438 Avg QP:13.22  size:   131
[libx264 @ 00000000005c6400] mb I  I16..4: 100.0%  0.0%  0.0%
[libx264 @ 00000000005c6400] mb P  I16..4:  0.1%  0.0%  0.0%  P16..4:  0.1%
 0.0%  0.0%  0.0%  0.0%    skip:99.9%
[libx264 @ 00000000005c6400] coded y,uvDC,uvAC intra: 34.1% 30.5% 29.8%
inter: 0.0% 0.1% 0.0%
[libx264 @ 00000000005c6400] i16 v,h,dc,p: 45% 48%  4%  4%
[libx264 @ 00000000005c6400] i8c dc,h,v,p: 49% 36% 12%  3%
[libx264 @ 00000000005c6400] kb/s:232.43
[aac @ 00000000005c8340] Qavg: 48946.633

Inspection of the output file is below:

ffmpeg -i Sessiontest2.mp4
ffmpeg version N-82889-g54931fd Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable
-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-li
bbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --enable-libmodplug --enabl
e-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenh264 --enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable
-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-lzma --enable-decklink --enable-zl
ib
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 68.100 / 57. 68.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Sessiontest2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.61.100
  Duration: 01:37:17.96, start: -0.003991, bitrate: 304 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 1366x768, 232 kb/s, 30 fps, 30 tb
r, 10000k tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono,
fltp, 67 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

If I follow the example used from the online documentation here:
https://trac.ffmpeg.org/wiki/DirectShow

You can see in this particular instance that it can either stream it to you
in a "raw pixel_format" (yuyv422 in this case), or as an mjpeg stream.
ffmpeg -f dshow -video_size 1280x720 -framerate 7.5 -pixel_format yuyv422
-i video="Integrated Camera" out.avi

...which is switching -video_size parameter before the codec and apply it
to my command this is what I get.

ffmpeg -rtbufsize 1000M -f dshow -video_size 1024x768 -i
video="screen-capture-rec
order":audio="Internal Mic (IDT High Definiti" -flags +global_header
-vcodec libx264 -pix_fmt yuv420p -video_size 1024x7
68 -preset ultrafast -acodec aac -ac 1 -ar 22050 "Sessiontest2.mp4"
ffmpeg version N-82966-g6993bb4 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable
-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-li
bbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --enable-libmodplug --enabl
e-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenh264 --enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable
-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-lzma --enable-decklink --enable-zl
ib
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[dshow @ 0000000000558fe0] Could not set video options
video=screen-capture-recorder:audio=Internal Mic (IDT High Definiti: I/O
error

If you are wondering what the screen capture recorder options are, they
would be this:

ffmpeg -list_options true -f dshow -i video="screen-capture-recorder"
ffmpeg version N-82966-g6993bb4 Copyright (c) 2000-2016 the FFmpeg
developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-dxva2
--enable-libmfx --enable-nvenc --enable-avisynth --enable
-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv
--enable-libass --enable-libbluray --enable-li
bbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm
--enable-libilbc --enable-libmodplug --enabl
e-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenh264 --enable-libopenjpeg --enable-li
bopus --enable-librtmp --enable-libsnappy --enable-libsoxr
--enable-libspeex --enable-libtheora --enable-libtwolame --en
able-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable
-libx264 --enable-libx265 --enable-libxavs --enable-libxvid
--enable-libzimg --enable-lzma --enable-decklink --enable-zl
ib
  libavutil      55. 43.100 / 55. 43.100
  libavcodec     57. 70.100 / 57. 70.100
  libavformat    57. 61.100 / 57. 61.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 68.100 /  6. 68.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
[dshow @ 000000000043a940] DirectShow video device options (from video
devices)
[dshow @ 000000000043a940]  Pin "Capture" (alternative pin name "1")
[dshow @ 000000000043a940]   pixel_format=bgr0  min s=1x1 fps=0.02 max
s=1366x768 fps=30
[dshow @ 000000000043a940]   pixel_format=bgr0  min s=1x1 fps=0.02 max
s=1366x768 fps=30
[dshow @ 000000000043a940]   pixel_format=bgr24  min s=1x1 fps=0.02 max
s=1366x768 fps=30
[dshow @ 000000000043a940]   pixel_format=rgb555le  min s=1x1 fps=0.02 max
s=1366x768 fps=30
[dshow @ 000000000043a940]   pixel_format=rgb555le  min s=1x1 fps=0.02 max
s=1366x768 fps=30
[dshow @ 000000000043a940]   pixel_format=rgb8  min s=1x1 fps=0.02 max
s=1366x768 fps=30
[dshow @ 000000000043a940]   pixel_format=yuv420p  min s=1x1 fps=0.02 max
s=1366x768 fps=30
leaving aero onvideo=screen-capture-recorder: Immediate exit requested

Anyone know what could be the problem?

Thanks in advance!

Tim


More information about the ffmpeg-user mailing list