ffmpeg criando mp4 a partir da última imagem perdida

1

Estou tentando criar um vídeo MP4 a partir de imagens estáticas, * .png e * .jpg. A última imagem está sendo removida do mp4. Alguém tem alguma pista para mim? As imagens no diretório são:

@bambam:/tmp/create_reel/images/holding-00005> identify img0000*.png
img00001.png PNG 1280x779 1280x779+0+0 8-bit sRGB 1.311MB 0.000u 0:00.000
img00002.png PNG 1280x779 1280x779+0+0 8-bit sRGB 728KB 0.000u 0:00.000
img00003.png PNG 1280x779 1280x779+0+0 8-bit sRGB 1.311MB 0.000u 0:00.000
img00004.png PNG 1280x779 1280x779+0+0 8-bit sRGB 728KB 0.000u 0:00.000

o ffmpeg é executado:

ffmpeg -r 0.15 -i img%05d.png -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -pix_fmt yuv420p output.mp4
ffmpeg version N-77739-g7ab37ca Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 5 (SUSE Linux)
  configuration: --prefix=/home/develop/ffmpeg_build --extra-cflags=-I/home/develop/ffmpeg_build/include --extra-ldflags=-L/home/develop/ffmpeg_build/lib --bindir=/home/develop/bin --pkg-config-flags=--static --enable-gpl --enable-nonfree --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
  libavutil      55. 13.100 / 55. 13.100
  libavcodec     57. 22.100 / 57. 22.100
  libavformat    57. 21.101 / 57. 21.101
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 23.100 /  6. 23.100
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, image2, from 'img%05d.png':
  Duration: 00:00:00.16, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: png, rgb24(pc), 1280x779, 25 fps, 25 tbr, 25 tbn, 25 tbc
[libx264 @ 0x386a200] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 LZCNT
[libx264 @ 0x386a200] profile High, level 3.2
[libx264 @ 0x386a200] 264 - core 148 r2 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf57.21.101
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x778, q=-1--1, 0.15 fps, 12288 tbn, 0.15 tbc
Metadata:
  encoder         : Lavc57.22.100 libx264
Side data:
  unknown side data type 10 (24 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
frame=    4 fps=0.0 q=-1.0 Lsize=     525kB time=00:00:13.33 bitrate=     322.7kbits/s speed=29.4x    
video:524kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.164819%
[libx264 @ 0x386a200] frame I:1     Avg QP:16.23  size:246200
[libx264 @ 0x386a200] frame P:2     Avg QP:16.29  size: 72244
[libx264 @ 0x386a200] frame B:1     Avg QP:15.11  size:145580
[libx264 @ 0x386a200] consecutive B-frames: 50.0% 50.0%  0.0%  0.0%
[libx264 @ 0x386a200] mb I  I16..4:  4.2% 43.3% 52.5%
[libx264 @ 0x386a200] mb P  I16..4: 21.6%  8.5% 19.7%  P16..4:  1.8%  0.1%  0.2%  0.0%  0.0%    skip:48.0%
[libx264 @ 0x386a200] mb B  I16..4: 43.4% 16.4% 39.8%  B16..8:  0.0%  0.1%  0.2%  direct: 0.0%  skip: 0.0%  L0:89.8% L1:10.2% BI: 0.0%
[libx264 @ 0x386a200] 8x8 transform intra:25.6% inter:2.6%
[libx264 @ 0x386a200] coded y,uvDC,uvAC intra: 62.8% 57.0% 49.5% inter: 1.1% 3.0% 0.2%
[libx264 @ 0x386a200] i16 v,h,dc,p: 76% 17%  4%  4%
[libx264 @ 0x386a200] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 11% 22% 16%  6%  8%  6% 11%  7% 11%
[libx264 @ 0x386a200] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 21% 12%  6%  8%  7%  8%  6%  7%
[libx264 @ 0x386a200] i8c dc,h,v,p: 39% 43% 12%  6%
[libx264 @ 0x386a200] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x386a200] ref P L0: 91.7%  5.8%  2.5%
[libx264 @ 0x386a200] kb/s:160.88

-rw-r--r-- 1 develop users 537839 Jan  9 10:27 output.mp4

Uma solução óbvia é duplicar a última imagem, embora seja um truque e prefiro criar o filme "corretamente"

    
por burtzerk 08.01.2016 / 22:42

2 respostas

0

A última imagem não está sendo descartada como tal. Cada quadro é desenhado de acordo com o timestamp de apresentação. A persistência de cada quadro ocorre entre o desenho de dois quadros. Após a última operação de desenho, a reprodução pára.

Além do truque de duplicar a última imagem, outro truque é gerar um áudio fictício de comprimento no. of frames x duration of each frame display - o segundo termo é um recíproco da taxa de quadros. Então, tente isto:

ffmpeg -r 0.15 -i img%05d.png -f lavfi -i "aevalsrc=0:d=26.667" -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -pix_fmt yuv420p output.mp4
    
por 09.01.2016 / 06:19
0

Eu acho que o problema está no mplayer. O comando     mplayer -fs -nasound mf: //*.png -mf fps = 1/5 " toca a última imagem por cerca de 1 segundo, todas as outras são tocadas por 5 segundos. Minha solução será usar outro player para imagens.

    
por 09.01.2016 / 21:14

Tags