Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 489
Henry Soang Avatar asked Dec 14 '25 13:12

Henry Soang


1 Answers

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
like image 126
Roy D'atze Avatar answered Dec 17 '25 21:12

Roy D'atze



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!