scrcpy icon indicating copy to clipboard operation
scrcpy copied to clipboard

ffmpeg how to receive raw_video_stream and push rtmp to web

Open a95000322 opened this issue 2 years ago • 3 comments

befor: image

after: image image

i try to use ffmpeg push rtmp, where is wrong ,plz help

a95000322 avatar May 24 '22 09:05 a95000322

Some devices have more than one encoder, and some of them may cause issues or crash. It is possible to select a different encoder:

scrcpy --encoder OMX.qcom.video.encoder.avc To list the available encoders, you can pass an invalid encoder name; the error will give the available encoders:

scrcpy --encoder _

Gajusbonus avatar Jul 07 '22 20:07 Gajusbonus

Hi, I don't think the data coming from the scrcpy server is directly usable for ffmpeg. it passes some data for basic information like checking the link and confirming the resolution before starting the raw h264 transfer. To get the data from the server, you need to discard all the first 69 bits of data transferred after establishing the socket link and create a new socket link for transferring the control information. Only then will the scrcpy server start sending the raw h264. If you want to use ffmpeg to pull streams directly, I think the following options might be available.

  • Edit the source code of the scrcpy-server and rebuild a version that transmits h264 data directly
  • Write your own forwarder that will forward the h264 data after it finishes dropping the data

Also: based on the content of your screenshot, I don't think scrcpy-server is running with an error, it's just informing you of the encoder it picked :)

Tryanks avatar Feb 06 '23 08:02 Tryanks

Hi, I don't think the data coming from the scrcpy server is directly usable for ffmpeg. it passes some data for basic information like checking the link and confirming the resolution before starting the raw h264 transfer. To get the data from the server, you need to discard all the first 69 bits of data transferred after establishing the socket link and create a new socket link for transferring the control information.

There are options to make it stream the raw h264. See https://code.videolan.org/rom1v/vlc/-/merge_requests/20.

rom1v avatar Feb 06 '23 09:02 rom1v