sipsorcery icon indicating copy to clipboard operation
sipsorcery copied to clipboard

"Option not found" with encoder option -vf scale=1280:720

Open hassan379 opened this issue 2 years ago • 2 comments

hello , thanks for this great library , it helps me alot , but i am facing an issue , i am trying to scale down the frame that i am passing to ffmpeg using encoderOptions in FFmpegVideoEncoder through "encoderOptions.Add("vf", "scale=1280:720");" but i am getting exception "Option not found" , but i checked the ffmpeg main website and it supported that option , other options like "encoderOptions.Add("preset", "ultrafast");" and "encoderOptions.Add("tune", "zerolatency");" are working great but the scaling doesn't work for me , can you tell me what is the problem , and what is the proper way to scale down the size of the frame to lower resolution through ffmpeg encoder ? many thanks

hassan379 avatar Jun 05 '22 11:06 hassan379

It's in my plan to have options like this in [SIPSorceryMedia.FFmpeg] (https://github.com/sipsorcery-org/SIPSorceryMedia.FFmpeg):

  • change frame resolution
  • change frame rate
  • retrieve only part of the image by specifying an area (x, y, width, height)

But I don't have the time for the moment to do that.

Don't hesitate to create a PR :)

ChristopheI avatar Jun 16 '22 09:06 ChristopheI

@ChristopheI thanks for your answer , i achieved that by changing the parameters (width , height) of the following lines inside "FFmpegVideoEncoder.cs" with any other resolutions but this process will reduce the fps

_encoderPixelConverter = new VideoFrameConverter(
   width, height,
   pixelFormat,
   width, height,
   AVPixelFormat.AV_PIX_FMT_YUV420P);

to

_encoderPixelConverter = new VideoFrameConverter(
   width, height,
   pixelFormat,
   1280, 720,
   AVPixelFormat.AV_PIX_FMT_YUV420P);

hassan379 avatar Jun 28 '22 08:06 hassan379