Henry Soang
Henry Soang

Reputation: 289

Not able to pipe gstreamer output into ffmpeg

has anybody gotten gstreamer to successfully pipe it's video output into ffmpeg?

I've tried playing with /dev/stdout and I keep getting errors:

gst-launch -e v4l2src device=/dev/video0 \
! 'video/x-raw-yuv,width=1920,height=1080,framerate=5/1'  \
! nv_omx_h264enc quality-level=2 ! mp4mux \
! filesink location=/dev/stdout \
 | ffmpeg -y -i - -codec copy   -f flv test.flv
...
[aac @ 0xebc4c0] Could not find codec parameters for stream 0 (Audio: aac (Main), 7.1, fltp, 1351 kb/s): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
pipe:: could not find codec parameters
Input #0, aac, from 'pipe:':
  Duration: N/A, bitrate: 1351 kb/s
    Stream #0:0: Audio: aac (Main), 7.1, fltp, 1351 kb/s
[flv @ 0xec9280] sample rate not set
Output #0, flv, to 'test.flv':
    Stream #0:0: Audio: aac, 7.1, 1351 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Running the commands separately (replacing /dev/stdout with a file) works fine.

If you got it to work and can share how you did it, that would be great.

Thanks.

Upvotes: 3

Views: 4164

Answers (1)

Roy D'atze
Roy D'atze

Reputation: 156

You can not use MP4 as a streaming format, as it cannot be parsed linear, e.g. without random access. Therefore it works with files, but not via a pipe.

Replacing the container format with a format that can be streamed should do the trick:

gst-launch -e v4l2src device=/dev/video0 \
! 'video/x-raw-yuv,width=1920,height=1080,framerate=5/1' \
! nv_omx_h264enc quality-level=2 ! matroskamux \
! filesink location=/dev/stdout \
 | ffmpeg -y -i - -codec copy -f flv test.flv

Upvotes: 2

Related Questions