Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
112.1k stars 10.72k forks source link

ffmpeg how to receive raw_video_stream and push rtmp to web #3292

Open a95000322 opened 2 years ago

a95000322 commented 2 years ago

befor: image

after: image image

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

Gajusbonus commented 2 years ago

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 _

Tryanks commented 1 year ago

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.

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 :)

rom1v commented 1 year ago

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.