E
E
Egor Mikheev2017-07-19 11:33:00
Video
Egor Mikheev, 2017-07-19 11:33:00

How to convert webm to flv using ffmpeg?

Hello, the task is to transcode an incoming video stream in webm format into an flv stream broadcast on the nginx rtmp module. There is such preparation but errors fall out. Source code
The solution is implemented on node js but the transcoding is done in a separate thread with a call to the ffmpeg console application

var ops=[
      '-vcodec', 'webm','-i','-',
      '-c:v', 'libx264', '-preset', 'veryfast', '-tune', 'zerolatency',
      '-an',
      '-bufsize', '1000',
      '-f', 'flv', rtmp://myrtmpserver.com/live
    ];

ffmpeg_process=spawn('ffmpeg', ops);

The problem is that when performing this operation, the following error occurs:
FFMPEG:[buffer @ 0x1f875a0] Unable to parse option value "-1" as pixel format

When defining stream parameters, the pixel size is indeed unavailable:
Stream #0:1(eng): Video: vp8, none, 640x480, SAR 1:1 DAR 4:3, 16.67 tbr, 1k tbn,

If you sample the flow manually:
var ops = [ '-i','-']
 ffmpeg_process=spawn('ffprobe', ops);

Dump
Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p, 640x480, SAR 1:1 DAR 4:3, 30.30 fps, 16.67 tbr, 1k tbn, 60 tbc (default)

Full dump
FFMPEG:[matroska,webm @ 0x1f2b560] Could not find codec parameters for stream 1 (Video: vp8, none, 640x480): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, matroska,webm, from 'pipe:':
  Metadata:
    encoder         : Chrome
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
    Stream #0:1(eng): Video: vp8, none, 640x480, SAR 1:1 DAR 4:3, 16.67 tbr, 1k tbn, 
FFMPEG:1k tbc (default)

FFMPEG:[buffer @ 0x1f875a0] Unable to parse option value "-1" as pixel format
    Last message repeated 1 times
[buffer @ 0x1f875a0] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:1 @ 0x1f8d7a0] Error applying options to the filter.

FFMPEG:Error opening filters!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Mikheev, 2017-07-19
@ogregor

var ops=[
      '-i', '-',
      '-c:v', 'libx264', '-preset', 'fast', '-strict', '-2', //'-tune', 'zerolatency'
      '-c:a', 'aac', '-b:a', '128k',
      '-f', 'flv', socket._rtmpDestination
        ];

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question