Skip to content
TheChatArchiveThe Chat Archive
Human-written demonstration (OpenAssistant volunteers)· OpenAssistant (human-written)Hugging Face OpenAssistant Conversations (oasst2)

How would I change the exposure of a series of images with ffmpeg while compiling into…

In OpenAssistant data, “assistant” turns were written by human volunteers as demonstrations. They are not model outputs.
  1. User

    How would I change the exposure of a series of images with ffmpeg while compiling into an MP4, please give a command line example.

  2. Assistant

    To change the exposure of a series of images using ffmpeg, you can use the "curves" filter. This filter allows you to adjust the brightness and contrast of an image.

    Here is an example command that changes the exposure of a series of images and compiles them into an MP4:

    ffmpeg -i image-%d.png -vf "curves=levels=0:0.5:1" -c:v libx264 -pix_fmt yuv420p output.mp4
    

    In this command:

    • image-%d.png specifies the input images, where %d is a placeholder for the frame number.
    • curves=levels=0:0.5:1 specifies the "curves" filter and sets the exposure to 0.5. The levels parameter takes three values: the minimum input level, the middle level, and the maximum input level. In this example, 0:0.5:1 means that the minimum input level is 0, the middle level is 0.5, and the maximum input level is 1.
    • libx264 specifies the H.264 video codec to be used for encoding the output video.
    • yuv420p specifies the pixel format for the output video.
    • output.mp4 is the name of the output file.

    Note that this is just one example, and you can adjust the exposure further by changing the values in the "curves" filter.

  3. User

    Can you rewrite this, but with AV1 encoding and outputting to a .MKV file instead?

  4. Assistant

    Here's the modified command using AV1 encoding and outputting to a .MKV file:

    ffmpeg -i image-%d.png -vf "curves=levels=0:0.5:1" -c:v libaom-av1 -strict experimental -crf 30 -b:v 0 -pix_fmt yuv420p output.mkv
    

    In this command:

    • image-%d.png specifies the input images, where %d is a placeholder for the frame number.
    • curves=levels=0:0.5:1 specifies the "curves" filter and sets the exposure to 0.5.
    • libaom-av1 specifies the AV1 video codec to be used for encoding the output video.
    • strict experimental is required for using the AV1 codec.
    • crf 30 sets the Constant Rate Factor (CRF) to 30, which determines the quality of the output video. Lower values result in better quality but larger file sizes. You can adjust this value to your preference.
    • b:v 0 sets the target bitrate to 0, meaning the encoder will use the CRF value instead to determine video quality.
    • yuv420p specifies the pixel format for the output video.
    • output.mkv is the name of the output file in the MKV format.

    Keep in mind that encoding with AV1 can be slower compared to other codecs like H.264 (libx264). You can adjust the CRF value and other parameters to achieve the desired balance between quality and encoding time.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.