Eu uso o comando abaixo para cortá-lo em quadros. Quero 48 quadros para o meu vídeo, que são 7 segundos.
ffmpeg -i output.avi -r 6.4 -s sxga images\\image%d.jpeg
Ele me cria os quadros, mas eu o uso com vídeos diferentes e me dá resultados diferentes. O output.avi é de 7 segundos, mas ele me dá 46 - 50 quadros, dependendo do vídeo de saída que eu insiro.
A saída da linha de comando para o primeiro vídeo é:
>ffmpeg -i "only7s.avi" -r 6.4 -s sxga images\\image%d.jpeg
ffmpeg version N-62121-g634636e Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 3 2014 23:30:16 with gcc 4.8.2 (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-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable
-zlib
libavutil 52. 73.100 / 52. 73.100
libavcodec 55. 56.107 / 55. 56.107
libavformat 55. 36.101 / 55. 36.101
libavdevice 55. 11.100 / 55. 11.100
libavfilter 4. 3.100 / 4. 3.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, avi, from 'only7s.avi':
Metadata:
encoder : Lavf55.36.101
Duration: 00:00:07.04, start: 0.000000, bitrate: 4890 kb/s
Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p, 1024x768, 4924
kb/s, 30 fps, 30 tbr, 30 tbn, 59.99 tbc
Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 1
28 kb/s
[swscaler @ 0358bec0] deprecated pixel format used, make sure you did set range
correctly
Output #0, image2, to 'images\\image%d.jpeg':
Metadata:
encoder : Lavf55.36.101
Stream #0:0: Video: mjpeg, yuvj420p, 1280x1024, q=2-31, 200 kb/s, 90k tbn, 6
.40 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
*** dropping frame 8 from stream 0 at ts 5
*** dropping frame 9 from stream 0 at ts 6
Last message repeated 3 times
*** dropping frame 10 from stream 0 at ts 7
Last message repeated 3 times
frame= 11 fps=0.0 q=22.7 size=N/A time=00:00:01.71 bitrate=N/A dup=4 drop=9
*** dropping frame 11 from stream 0 at ts 8
Last message repeated 2 times
*** dropping frame 12 from stream 0 at ts 9
Last message repeated 3 times
*** dropping frame 13 from stream 0 at ts 10
Last message repeated 3 times
*** dropping frame 14 from stream 0 at ts 11
Last message repeated 1 times
*** dropping frame 15 from stream 0 at ts 12
*** dropping frame 16 from stream 0 at ts 13
Last message repeated 1 times
*** dropping frame 17 from stream 0 at ts 14
*** dropping frame 18 from stream 0 at ts 15
frame= 19 fps= 18 q=24.8 size=N/A time=00:00:02.96 bitrate=N/A dup=4 drop=27
*** dropping frame 19 from stream 0 at ts 16
Last message repeated 1 times
*** dropping frame 20 from stream 0 at ts 17
*** dropping frame 21 from stream 0 at ts 18
*** dropping frame 22 from stream 0 at ts 19
Last message repeated 1 times
*** dropping frame 23 from stream 0 at ts 20
*** dropping frame 24 from stream 0 at ts 21
frame= 24 fps= 15 q=24.8 size=N/A time=00:00:03.75 bitrate=N/A dup=4 drop=35
*** dropping frame 25 from stream 0 at ts 22
Last message repeated 1 times
*** dropping frame 26 from stream 0 at ts 23
*** dropping frame 27 from stream 0 at ts 24
*** dropping frame 28 from stream 0 at ts 25
Last message repeated 1 times
*** dropping frame 29 from stream 0 at ts 26
*** dropping frame 30 from stream 0 at ts 27
*** dropping frame 31 from stream 0 at ts 28
frame= 31 fps= 15 q=24.8 size=N/A time=00:00:04.84 bitrate=N/A dup=4 drop=44
*** dropping frame 31 from stream 0 at ts 28
*** dropping frame 32 from stream 0 at ts 29
*** dropping frame 33 from stream 0 at ts 30
*** dropping frame 34 from stream 0 at ts 31
Last message repeated 1 times
*** dropping frame 35 from stream 0 at ts 32
*** dropping frame 36 from stream 0 at ts 33
Last message repeated 1 times
frame= 37 fps= 14 q=24.8 size=N/A time=00:00:05.78 bitrate=N/A dup=4 drop=52
*** dropping frame 37 from stream 0 at ts 34
*** dropping frame 38 from stream 0 at ts 35
*** dropping frame 39 from stream 0 at ts 36
Last message repeated 1 times
*** dropping frame 40 from stream 0 at ts 37
*** dropping frame 41 from stream 0 at ts 38
*** dropping frame 42 from stream 0 at ts 39
Last message repeated 1 times
frame= 43 fps= 14 q=24.8 size=N/A time=00:00:06.71 bitrate=N/A dup=4 drop=60
*** dropping frame 43 from stream 0 at ts 40
*** dropping frame 44 from stream 0 at ts 41
*** dropping frame 45 from stream 0 at ts 42
Last message repeated 1 times
*** dropping frame 46 from stream 0 at ts 43
*** dropping frame 47 from stream 0 at ts 44
frame= 47 fps= 13 q=24.8 Lsize=N/A time=00:00:07.34 bitrate=N/A dup=4 drop=66
video:2537kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 709977824034816.000000%
A saída da linha de comando para o segundo vídeo é:
>ffmpeg -i "C:\ArtWedding\bin\x86\Debug\flipvideo\video180327.avi" -r 6.4 -s sxg
a images\\image%d.jpeg
ffmpeg version N-62121-g634636e Copyright (c) 2000-2014 the FFmpeg developers
built on Apr 3 2014 23:30:16 with gcc 4.8.2 (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-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aa
cenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavp
ack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable
-zlib
libavutil 52. 73.100 / 52. 73.100
libavcodec 55. 56.107 / 55. 56.107
libavformat 55. 36.101 / 55. 36.101
libavdevice 55. 11.100 / 55. 11.100
libavfilter 4. 3.100 / 4. 3.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, avi, from 'C:\ArtWedding\bin\x86\Debug\flipvideo\video180327.avi':
Metadata:
encoder : Lavf55.36.101
Duration: 00:00:07.47, start: 0.000000, bitrate: 128364 kb/s
Stream #0:0: Video: rawvideo, bgr24, 640x480, 128928 kb/s, 30 tbr, 30 tbn, 3
0 tbc
[swscaler @ 029adf40] deprecated pixel format used, make sure you did set range
correctly
Output #0, image2, to 'images\\image%d.jpeg':
Metadata:
encoder : Lavf55.36.101
Stream #0:0: Video: mjpeg, yuvj444p, 1280x1024, q=2-31, 200 kb/s, 90k tbn, 6
.40 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo -> mjpeg)
Press [q] to stop, [?] for help
*** dropping frame 10 from stream 0 at ts 7
frame= 10 fps=0.0 q=19.9 size=N/A time=00:00:01.56 bitrate=N/A dup=1 drop=1
*** dropping frame 10 from stream 0 at ts 7
*** dropping frame 11 from stream 0 at ts 8
Last message repeated 2 times
*** dropping frame 12 from stream 0 at ts 9
*** dropping frame 13 from stream 0 at ts 10
Last message repeated 1 times
*** dropping frame 14 from stream 0 at ts 11
*** dropping frame 15 from stream 0 at ts 12
frame= 16 fps= 16 q=24.8 size=N/A time=00:00:02.50 bitrate=N/A dup=1 drop=10
*** dropping frame 16 from stream 0 at ts 13
*** dropping frame 17 from stream 0 at ts 14
Last message repeated 2 times
*** dropping frame 18 from stream 0 at ts 15
Last message repeated 3 times
*** dropping frame 19 from stream 0 at ts 16
*** dropping frame 21 from stream 0 at ts 18
frame= 21 fps= 14 q=24.8 size=N/A time=00:00:03.28 bitrate=N/A dup=1 drop=20
*** dropping frame 23 from stream 0 at ts 20
*** dropping frame 24 from stream 0 at ts 21
*** dropping frame 25 from stream 0 at ts 22
*** dropping frame 27 from stream 0 at ts 24
frame= 28 fps= 14 q=24.8 size=N/A time=00:00:04.37 bitrate=N/A dup=1 drop=24
*** dropping frame 29 from stream 0 at ts 26
*** dropping frame 31 from stream 0 at ts 28
*** dropping frame 33 from stream 0 at ts 30
*** dropping frame 34 from stream 0 at ts 31
Last message repeated 2 times
frame= 34 fps= 13 q=24.8 size=N/A time=00:00:05.31 bitrate=N/A dup=1 drop=30
*** dropping frame 35 from stream 0 at ts 32
Last message repeated 1 times
*** dropping frame 36 from stream 0 at ts 33
Last message repeated 3 times
*** dropping frame 37 from stream 0 at ts 34
Last message repeated 2 times
*** dropping frame 38 from stream 0 at ts 35
Last message repeated 3 times
frame= 39 fps= 13 q=24.8 size=N/A time=00:00:06.09 bitrate=N/A dup=1 drop=43
*** dropping frame 39 from stream 0 at ts 36
Last message repeated 3 times
*** dropping frame 40 from stream 0 at ts 37
Last message repeated 2 times
*** dropping frame 41 from stream 0 at ts 38
Last message repeated 2 times
*** dropping frame 42 from stream 0 at ts 39
Last message repeated 1 times
*** dropping frame 43 from stream 0 at ts 40
frame= 43 fps= 12 q=24.8 size=N/A time=00:00:06.71 bitrate=N/A dup=1 drop=56
*** dropping frame 44 from stream 0 at ts 41
Last message repeated 3 times
*** dropping frame 45 from stream 0 at ts 42
Last message repeated 3 times
*** dropping frame 46 from stream 0 at ts 43
Last message repeated 2 times
*** dropping frame 47 from stream 0 at ts 44
Last message repeated 2 times
frame= 47 fps= 11 q=24.8 size=N/A time=00:00:07.34 bitrate=N/A dup=1 drop=70
*** dropping frame 48 from stream 0 at ts 45
Last message repeated 2 times
*** dropping frame 49 from stream 0 at ts 46
Last message repeated 2 times
*** dropping frame 50 from stream 0 at ts 47
Last message repeated 1 times
frame= 50 fps= 11 q=24.8 size=N/A time=00:00:07.81 bitrate=N/A dup=1 drop=78
*** dropping frame 50 from stream 0 at ts 47
Last message repeated 1 times
frame= 51 fps= 11 q=24.8 Lsize=N/A time=00:00:07.96 bitrate=N/A dup=1 drop=80
video:4415kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing
overhead: 407988875558912.000000%
Inclua também as saídas completas da linha de comando para dois casos diferentes. Se você tiver uma amostra de vídeo, seria ainda melhor.
—
slhck
eu edito isso. e eu escrevi os resultados de ambos os vídeos.
—
Apelido
Um é 7,04 segundos e o outro é 07,47 segundos. Claro que você terá diferentes números de quadros como saída. Se você deseja que o ffmpeg escreva um número específico de quadros, adicione a
—
slhck
-frames:v 48
opção, por exemplo. Isso alcança o que você precisa?
Somente no segundo. No primeiro, que cria 47 quadros. Ele não cria 48.
—
NickName
Como o 47º quadro já está além da duração total, não há 48º quadro que ele possa criar. Você pode precisar usar outra taxa de quadros nesse caso para poder "esticá-la".
—
slhck