Não é possível cortar o fluxo de vídeo canalizado com o FFmpeg

0

Tentando cortar um arquivo de vídeo que é canalizado da entrada padrão, ele só funciona quando a duração de início é maior que 2.0s para alguns vídeos (falha para os capturados de um telefone Android para serem específicos).

Quando ss é definido como 2.0, ou seja, ffmpeg -y -ss 00:00:02.0 -vcodec h264 -acodec aac -i pipe:0 -t 7 output_file.mp4 , ele falha com a saída [mov,mp4,m4a,3gp,3g2,mj2 @ 0xecf920] stream 1, offset 0x65ea3: partial file pipe:0: Invalid data found when processing input .

Aqui está o log completo:

$ cat camera_landscape.mp4 | ffmpeg -y -ss 00:00:02.0 -vcodec h264 -acodec aac -i pipe:0 -t 7 camera_landscape_test.mp4 
ffmpeg version 2.6.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2015-09-27 09:46:32
  Duration: 00:00:16.96, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 640x480, 5744 kb/s, SAR 1:1 DAR 4:3, 28.68 fps, 28.67 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : SoundHandle
[libx264 @ 0xee1000] using SAR=1/1
[libx264 @ 0xee1000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0xee1000] profile High, level 3.0
[libx264 @ 0xee1000] 264 - core 146 - 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=6 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=25 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 'camera_landscape_test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf56.25.101
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 28.67 fps, 11008 tbn, 28.67 tbc (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : VideoHandle
      encoder         : Lavc56.26.100 libx264
    Stream #0:1(eng): Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 48000 Hz, mono, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : SoundHandle
      encoder         : Lavc56.26.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
[mov,mp4,m4a,3gp,3g2,mj2 @ 0xecf920] stream 1, offset 0x65ea3: partial file
pipe:0: Invalid data found when processing input
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.00 bitrate=N/A    
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Qualquer coisa maior que 2.0 é bem-sucedida, como tal:

$ cat camera_landscape.mp4 | ffmpeg -y -ss 00:00:02.1 -vcodec h264 -acodec aac -i pipe:0 -t 7 camera_landscape_test.mp4 
ffmpeg version 2.6.4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 20.100 / 54. 20.100
  libavcodec     56. 26.100 / 56. 26.100
  libavformat    56. 25.101 / 56. 25.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 11.102
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2015-09-27 09:46:32
  Duration: 00:00:16.96, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p, 640x480, 5744 kb/s, SAR 1:1 DAR 4:3, 28.68 fps, 28.67 tbr, 90k tbn, 180k tbc (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : VideoHandle
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 95 kb/s (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : SoundHandle
[libx264 @ 0xbe5000] using SAR=1/1
[libx264 @ 0xbe5000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
[libx264 @ 0xbe5000] profile High, level 3.0
[libx264 @ 0xbe5000] 264 - core 146 - 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=6 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=25 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 'camera_landscape_test.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf56.25.101
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 640x480 [SAR 1:1 DAR 4:3], q=-1--1, 28.67 fps, 11008 tbn, 28.67 tbc (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : VideoHandle
      encoder         : Lavc56.26.100 libx264
    Stream #0:1(eng): Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 48000 Hz, mono, s16, 128 kb/s (default)
    Metadata:
      creation_time   : 2015-09-27 09:46:32
      handler_name    : SoundHandle
      encoder         : Lavc56.26.100 libfaac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libfaac))
frame=  201 fps= 70 q=-1.0 Lsize=     543kB time=00:00:07.01 bitrate= 634.0kbits/s dup=1 drop=0    
video:465kB audio:71kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.238381%
[libx264 @ 0xbe5000] frame I:1     Avg QP:21.12  size:  5005
[libx264 @ 0xbe5000] frame P:200   Avg QP:22.80  size:  2354
[libx264 @ 0xbe5000] mb I  I16..4: 17.2% 82.0%  0.8%
[libx264 @ 0xbe5000] mb P  I16..4:  5.2%  9.7%  0.0%  P16..4: 53.7%  3.0%  3.4%  0.0%  0.0%    skip:25.0%
[libx264 @ 0xbe5000] 8x8 transform intra:65.7% inter:97.4%
[libx264 @ 0xbe5000] coded y,uvDC,uvAC intra: 27.7% 59.6% 0.0% inter: 20.1% 49.5% 0.0%
[libx264 @ 0xbe5000] i16 v,h,dc,p: 21% 31% 24% 24%
[libx264 @ 0xbe5000] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 14% 58%  3%  3%  3%  3%  2%  2%
[libx264 @ 0xbe5000] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14%  6% 66%  4%  3%  3%  3%  1%  1%
[libx264 @ 0xbe5000] i8c dc,h,v,p: 62% 21% 16%  1%
[libx264 @ 0xbe5000] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0xbe5000] ref P L0: 38.2%  4.0% 33.1% 24.8%
[libx264 @ 0xbe5000] kb/s:542.91

Tudo funciona bem se a entrada for referenciada como um arquivo ( i diretamente), mas a tubulação é obrigatória. Como teste, um arquivo do Youtube também foi testado, resultando em sucesso. A questão aqui é: por que essa operação falha nesse vídeo específico e como resolvê-lo.

Editar: link de vídeo temporário - link

    
por razzledazzle 28.09.2015 / 11:26

0 respostas