Cortando duas partes do meio de um vídeo com ffmpeg

1

Eu tenho dois arquivos, rec.avi e audio_edited.wav, e o que estou tentando fazer é pegar as partes 00: 30: 50–01: 42: 56 e 02: 16: 55–04: 03: 10 de cada arquivo, concatene-os e codifique-os em um arquivo WebM. Meu comando atual é parcialmente copiado de outras perguntas aqui e se parece com isso:

ffmpeg -i rec.avi -i audio_edited.wav -filter_complex \
"[0:v]trim=start=1805:end=6176,setpts=PTS-STARTPTS[bv];\
 [1:a]atrim=start=1805:end=6176,asetpts=PTS-STARTPTS[ba];\
 [0:v]trim=start=8215:end=14590,setpts=PTS-STARTPTS[dv];\
 [1:a]atrim=start=8215:end=14590,asetpts=PTS-STARTPTS[da];\
 [bv][ba][dv][da]concat=n=2:v=1:a=1[outv][outa]" \
 -map [outv] -map [outa] -c:v libvpx -crf 10 -b:v 5M -c:a libvorbis out.webm

Mas quando eu tento executá-lo, o ffmpeg simplesmente para em

frame=    0 fps=0.0 q=0.0 Lsize=       4kB time=00:00:00.00 bitrate=35808.0kbits/s    

e quando eu saio do comando, recebo as seguintes mensagens:

[libvorbis @ 0x2549a60] Trying to remove 128 samples, but the queue is empty
[webm @ 0x243c820] Encoder did not produce proper pts, making some up.

Alguém pode me dar um ponteiro? Estou no fim da minha sagacidade.

Saída completa:

$ ./convert.sh
ffmpeg version 2.1.7 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan  3 2015 22:57:36 with gcc 4.8.3 (GCC) 20140911 (Red Hat 4.8.3-7)
  configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-frei0r --enable-gnutls --enable-libass --enable-libcdio --enable-libcelt --enable-libdc1394 --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libvpx --enable-libx264 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[avi @ 0x23ff400] non-interleaved AVI
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, avi, from 'rec.avi':
  Duration: 04:05:14.04, start: 0.000000, bitrate: 104136 kb/s
    Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc), 1920x1080, 102584 kb/s, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
Guessed Channel Layout for  Input Stream #1.0 : stereo
Input #1, wav, from 'audio_edited.wav':
  Metadata:
    encoder         : Lavf55.19.104 (libsndfile-1.0.24)
  Duration: 04:05:14.04, bitrate: 1536 kb/s
    Stream #1:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s16, 1536 kb/s
File 'out.webm' already exists. Overwrite ? [y/N] y
[swscaler @ 0x2422680] deprecated pixel format used, make sure you did set range correctly
[libvpx @ 0x243a800] v1.3.0
Output #0, webm, to 'out.webm':
  Metadata:
    encoder         : Lavf55.19.104
    Stream #0:0: Video: vp8 (libvpx), yuv420p, 1920x1080, q=-1--1, 5000 kb/s, 1k tbn, 25 tbc (default)
    Stream #0:1: Audio: vorbis (libvorbis), 48000 Hz, stereo, fltp (default)
Stream mapping:
  Stream #0:0 (mjpeg) -> trim
  Stream #0:0 (mjpeg) -> trim
  Stream #1:0 (pcm_s16le) -> atrim
  Stream #1:0 (pcm_s16le) -> atrim
  concat:out:v0 -> Stream #0:0 (libvpx)
  concat:out:a0 -> Stream #0:1 (libvorbis)
Press [q] to stop, [?] for help
[libvorbis @ 0x2549a60] Trying to remove 128 samples, but the queue is empty
[webm @ 0x243c820] Encoder did not produce proper pts, making some up.
frame=    0 fps=0.0 q=0.0 Lsize=       4kB time=00:00:00.00 bitrate=35808.0kbits/s    
video:0kB audio:0kB subtitle:0 global headers:4kB muxing overhead 13.201821%
    
por Fujnky 26.03.2015 / 20:38

1 resposta

0

Eu resolvi: não há nenhum problema com esse comando. Aparentemente, leva apenas algum tempo até que o ffmpeg tenha procurado o meu AVI até encontrar o ponto onde quero que ele comece.

    
por 27.03.2015 / 20:44