Skip to content

Conversation

@streamthing
Copy link

This pull request introduces the ability to adjust JPEG quality in the FFmpeg-based processing pipeline by adding a quality parameter. The value of this parameter is directly passed to -q:v in FFmpeg, allowing users to control the output image compression level.

Changes

1. Modified internal/ffmpeg/jpeg.go

  • Added a quality variable to parse query parameters.
  • Implemented logic to append -q:v {quality} to the FFmpeg arguments if the parameter is provided.

2. Updated README.md

  • Added documentation for the new quality parameter, explaining that it allows users to change the JPEG quality (e.g., quality=1).

Usage Example

Users can now control the JPEG compression level via a URL query parameter:

http://<go2rtc_ip>:1984/api/frame.jpeg?src=camera&quality=1

Where:

  • quality=1 → Highest quality, larger file size.
  • quality=31 → Lowest quality, smaller file size.

Why this change?

This update provides greater flexibility in adjusting image quality and file size based on user needs, making the API more versatile.

@AlexxIT AlexxIT self-assigned this Mar 14, 2025
@felipecrs
Copy link
Contributor

This is awesome. Maybe in future we can support also resolution (or width and height) to avoid unnecessary data transfer while requesting a small icon, for example.

@felipecrs
Copy link
Contributor

Nevermind... it's already supported. 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants