FFmpeg falha ao transmitir para o FMS 4.5

1

Estou tentando usar o ffmpeg para transcodificar um vídeo de entrada de qualquer formato em um mp4 com vídeo h.264 e áudio MP3 e ter a saída diretamente para o FMS 4.5 usando o rtmp para que o vídeo flua logo após ser transcodificado. Meu comando ffmpeg é:

ffmpeg -re -y -i /videos/to/be/transcoded/001 -c:v libx264 -b:v 480k -c:a libmp3lame -b:a 128k -f mp4 "rtmp://localhost/live/livestream"

Saída:

ffmpeg version 1.2.1 Copyright (c) 2000-2013 the FFmpeg developers
  built on May 10 2013 15:14:14 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/global/xcodes/1/transcodeTest/vidInput/001':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2013-03-31 19:51:36
  Duration: 00:01:19.18, start: 0.000000, bitrate: 708 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x360, 610 kb/s, 25 fps, 25 tbr, 50 tbn, 50 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 95 kb/s
    Metadata:
      creation_time   : 2013-03-31 19:51:37
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
[libx264 @ 0x1a82ec0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0x1a82ec0] profile High, level 3.0
[libx264 @ 0x1a82ec0] 264 - core 130 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - 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=24 lookahead_threads=2 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=abr mbtree=1 bitrate=480 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[mp4 @ 0x1a826c0] muxer does not support non seekable output
Output #0, mp4, to 'rtmp://172.30.3.20/live/livestream':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf54.63.104
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x360, q=-1--1, 480 kb/s, 90k tbn, 25 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: mp3 (i[0][0][0] / 0x0069), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      creation_time   : 2013-03-31 19:51:37
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> libx264)
  Stream #0:1 -> #0:1 (aac -> libmp3lame)
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted

O erro que recebo é "Não foi possível gravar o cabeçalho do arquivo de saída # 0 (parâmetros incorretos do codec?): Operação não permitida". Mas se eu executar este mesmo comando e tiver a saída ffmpeg para um novo arquivo de vídeo, não recebo este erro.

O que está errado e como posso evitar esse erro?

    
por user2565986 07.08.2013 / 20:28

1 resposta

1

Acho que este é o problema:

mp4 requires a seekable output, since it writes a MOOV atom at the start of the file once it finishes encoding the file. Therefore, this is not a suitable format for feeding data to rtmp.

Noice este erro na sua saída:

[mp4 @ 0x1a826c0] muxer does not support non seekable output

Tente usar o FLV para o contêiner em vez de o MP4. Substitua -f mp4 por -f flv no seu comando.

    
por 08.08.2013 / 03:19