FFMPEG recebe fluxo do pipe via netcat falha

1

Estou tentando receber um fluxo via netcat e canalizá-lo para o FFMPEG e, em seguida, enviá-lo para um arquivo, mas estou recebendo um erro.

O comando mais básico que tentei foi:

$ nc -l -p 1935 | ffmpeg -v debug -y -f h264 -i pipe:0 out.mp4

ffmpeg version 3.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.8.2 (GCC)
  configuration: --prefix=/pkg/ffmpeg.org/3.1/ffmpeg --libdir=/usr/lib64 --shlibdir=/usr/lib64 --incdir=/usr/include --enable-gpl --enable-libx264 --enable-shared --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libtheora --enable-libvorbis --enable-libx264 --enable-postproc --enable-runtime-cpudetect --enable-memalign-hack --enable-pthreads --disable-x11grab --enable-bzlib --enable-zlib --enable-static --enable-libmp3lame --enable-libx264 --enable-librtmp
  libavutil      55. 27.100 / 55. 27.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 40.101 / 57. 40.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'h264'.
Reading option '-i' ... matched as input file with argument 'pipe:0'.
Reading option 'out.mp4' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file pipe:0.
Applying option f (force format) with argument h264.
Successfully parsed a group of options.
Opening an input file: pipe:0.
[pipe @ 0xe79c80] Setting default whitelist 'crypto'
[h264 @ 0xe794c0] Before avformat_find_stream_info() pos: 0 bytes read:1537 seeks:0 nb_streams:1
[h264 @ 0xe82b00] sps_id 5 out of range
[h264 @ 0xe82b00] missing picture in access unit with size 1537
[h264 @ 0xe82b00] Invalid NAL unit 0, skipping.
[h264 @ 0xe82b00] no frame!
[h264 @ 0xe794c0] decoding for stream 0 failed
[h264 @ 0xe794c0] Could not find codec parameters for stream 0 (Video: h264, 1 reference frame, none(left)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[h264 @ 0xe794c0] After avformat_find_stream_info() pos: 1537 bytes read:1537 seeks:0 frames:1
Input #0, h264, from 'pipe:0':
  Duration: N/A, bitrate: N/A
    Stream #0:0, 1, 1/1200000: Video: h264, 1 reference frame, none(left), 25 tbr, 1200k tbn, 50 tbc
Successfully opened the file.
Parsing a group of options: output file out.mp4.
Successfully parsed a group of options.
Opening an output file: out.mp4.
[file @ 0xe925c0] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 1 logical cores


[graph 0 input from stream 0:0 @ 0xe9ac60] Setting 'video_size' to value '0x0'
[buffer @ 0xe9ad60] Unable to parse option value "0x0" as image size
[graph 0 input from stream 0:0 @ 0xe9ac60] Setting 'pix_fmt' to value '-1'
[buffer @ 0xe9ad60] Unable to parse option value "-1" as pixel format
[graph 0 input from stream 0:0 @ 0xe9ac60] Setting 'time_base' to value '1/1200000'
[graph 0 input from stream 0:0 @ 0xe9ac60] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0xe9ac60] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0xe9ac60] Setting 'frame_rate' to value '50/2'
[buffer @ 0xe9ad60] Unable to parse option value "0x0" as image size
[buffer @ 0xe9ad60] Error setting option video_size to value 0x0.
[graph 0 input from stream 0:0 @ 0xe9ac60] Error applying options to the filter.
Error opening filters!
[AVIOContext @ 0xe9a700] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0xe82000] Statistics: 1537 bytes read, 0 seeks

Por causa da mensagem Consider increasing the value for the 'analyzeduration' and 'probesize' options , tentei:

nc -l -p 1935 | ffmpeg -v debug -y -f h264 -analyzeduration 9M -probesize 9M -i pipe:0 out.mp4

Eu recebi o mesmo erro, então comecei a adicionar meus próprios parâmetros de codec, já que parece que não é possível determinar que tipo de fluxo é.

nc -l -p 1935 | ffmpeg -v debug -y -f h264 -c:a aac -pix_fmt yuv420p -s 1280x720 -framerate 30 -analyzeduration 9M -probesize 9M -i pipe:0 out.mp4

Mas agora eu recebo:

Option video_size not found.

Alguma idéia?

    
por David Rodd 03.08.2016 / 23:08

0 respostas