Looking at reducing the quality of MP4 (hevc encoded) videos (without audio) by using ffmpeg.
But to save a bit of time, trying to preview proposed changes using ffplay before committing to changes using ffmpeg.
I'm not sure it is possible to preview proposed changes to video quality using ffplay?
Is it possible to preview video quality changes using ffplay? If so, what is the command syntax please?
I understand the command syntax begins something like - ffplay input_video.mp4 -vf . . . the rest of the command input is not clear. And I think the command syntax for ffplay is different than that for ffmpeg(?)
+ Reply to Thread
Results 1 to 12 of 12
-
-
FFplay command syntax generally follows this structure: ffplay [options] [input_url]. Options can include various parameters for controlling playback, such as -vf for video filters, -af for audio filters, and -i to specify the input file or stream. For a complete list of options, you can refer to the FFmpeg documentation.
`ffplay` is a simple media player that is part of the FFmpeg suite. It is used to play multimedia files and streams. Below is a detailed description of the command syntax for `ffplay`.
### Basic Syntax
The basic syntax for `ffplay` is:
```sh
ffplay [options] input_file
```
### Options
`ffplay` supports a wide range of options that can be used to control its behavior. These options can be categorized into several groups:
#### Input Options
- `-i input_file`: Specify the input file or stream.
- `-f format`: Force the input or output format.
- `-re`: Read input at native frame rate. Mainly used for live streaming.
#### Output Options
- `-vf video_filter`: Set video filters.
- `-af audio_filter`: Set audio filters.
- `-f fmt`: Force the output format.
- `-ss position`: Seek to a given position in seconds.
- `-t duration`: Play `duration` seconds of the input.
- `-to time_stop`: Play until `time_stop`.
- `-vcodec codec`: Set the video codec.
- `-acodec codec`: Set the audio codec.
#### Display Options
- `-fs`: Force full screen.
- `-window_title title`: Set window title.
- `-vf scale=width:height`: Scale the video to the specified width and height.
- `-vf crop=width:height:y`: Crop the video to the specified dimensions and position.
- `-vf format=format`: Convert the video to the specified pixel format.
- `-vf drawtext=text='text':fontcolor=color`: Overlay text on the video.
- `-vf drawbox=x:y:w:h:color`: Draw a box on the video.
- `-vf drawgrid=w:h`: Draw a grid on the video.
#### Control Options
- `-autoexit`: Exit when the end of the file is reached.
- `-loop loop_count`: Loop the input file `loop_count` times.
- `-nodisp`: Disable video display.
- `-noborder`: Borderless window.
- `-showmode mode`: Set the display mode (e.g., `video`, `waveform`, `vectorscope`).
- `-framerate fps`: Set the frame rate.
- `-pix_fmt format`: Set the pixel format.
- `-v sync`: Set video sync method (e.g., `auto`, `passthrough`, `drop`, `dup`).
- `-a sync`: Set audio sync method (e.g., `auto`, `passthrough`, `drop`, `dup`).
- `-vsync vsync`: Set video sync method (e.g., `auto`, `passthrough`, `drop`, `dup`).
- `-ssf start_time`: Seek to a given start time.
- `-etf end_time`: Seek to a given end time.
#### Advanced Options
- `-loglevel level`: Set the logging level (e.g., `quiet`, `panic`, `fatal`, `error`, `warning`, `info`, `verbose`, `debug`, `trace`).
- `-stats`: Show detailed statistics.
- `-benchmark`: Show benchmarking information.
- `-benchmark_all`: Show benchmarking information for all components.
- `-vf "filter1,filter2,..."`: Apply multiple video filters.
- `-af "filter1,filter2,..."`: Apply multiple audio filters.
### Examples
1. **Play a video file**:
```sh
ffplay input.mp4
```
2. **Play a video file with a specific start time**:
```sh
ffplay -ss 30 input.mp4
```
3. **Play a video file with a specific duration**:
```sh
ffplay -t 60 input.mp4
```
4. **Play a video file in full screen**:
```sh
ffplay -fs input.mp4
```
5. **Play a video file with a specific window title**:
```sh
ffplay -window_title "My Video" input.mp4
```
6. **Play a video file with a specific video filter**:
```sh
ffplay -vf "scale=640:480" input.mp4
```
7. **Play a video file with a specific audio filter**:
```sh
ffplay -af "volume=2" input.mp4
```
8. **Play a video file with a specific pixel format**:
```sh
ffplay -pix_fmt yuv420p input.mp4
```
9. **Play a video file with a specific frame rate**:
```sh
ffplay -framerate 30 input.mp4
```
10. **Play a video file with a specific video sync method**:As always .. there is nothing wrong with my environment -
Thank you very much for the comprehensive reply!
But it is not clear as to which filter to use to reduce quality of the video? I can't seem to find the appropriate filter to use. -
To reduce the video quality while playing a video with `ffplay`, you can use the `-vf` (video filter) option to apply various filters that can degrade the quality. One common approach is to use the `scale` filter to reduce the resolution of the video. Here are some examples of how you can do this:
Code:### Reduce Resolution You can scale down the video to a lower resolution. For example, to scale the video to 640x480 pixels, you can use the following command: ```sh ffplay -vf "scale=640:480" input.mp4 ``` ### Reduce Bitrate If you want to reduce the bitrate, you can use the `bitrate` filter. However, `ffplay` does not support direct bitrate reduction during playback. Instead, you would need to re-encode the video with a lower bitrate using `ffmpeg` and then play it with `ffplay`. Here’s how you can do it with `ffmpeg`: ```sh ffmpeg -i input.mp4 -b:v 500k output.mp4 ffplay output.mp4 ``` In this example, `-b:v 500k` sets the video bitrate to 500 kbps. ### Apply a Blur Filter You can also apply a blur filter to reduce the quality. For example, to apply a Gaussian blur: ```sh ffplay -vf "gblur=sigma=5" input.mp4 ``` ### Combine Filters You can combine multiple filters to achieve the desired quality reduction. For example, to scale down the resolution and apply a blur: ```sh ffplay -vf "scale=640:480,gblur=sigma=5" input.mp4 ``` ### Example Command Here is a complete example command that scales the video to 640x480 and applies a Gaussian blur: ```sh ffplay -vf "scale=640:480,gblur=sigma=5" input.mp4 ```
- `ffplay` is primarily a playback tool and does not support all the encoding options that `ffmpeg` does. For more advanced quality reduction, consider using `ffmpeg` to preprocess the video before playing it with `ffplay`.
- The filters and options available in `ffplay` and `ffmpeg` can be extensive. Refer to the [FFmpeg documentation](https://ffmpeg.org/documentation.html) for more details on available filters and options.Last edited by videoAI; 28th Jun 2025 at 08:14.
As always .. there is nothing wrong with my environment -
As always .. there is nothing wrong with my environment
-
Thanks for the additional comments.
The (test) MP4 videos are from a game and range in size from 9 kB to 27 MB. There are 1123 MP4 video files. Total size of all videos being 706 MB.
Using ffmpeg, I (batch) re-encoded all the videos using the command - ffmpeg -i input_video.mp4 -vcodec libx265 -crf 30 output_video.mp4.
I found the crf value of around 30 to be good for these videos with no (obvious) sign of image degradation. Higher crf values tried, such as crf of 35 produced videos with noticeable aberrations.
As for the piping to ffplay, at the moment I can't get it to work as I get error message that ffplay requires an output file -
Code::ffmpeg -i 011_cs_final.mp4 -vcodec libx265 -crf 34 | ffplay
And trying -
Code::ffmpeg -i 011_cs_final.mp4 -vcodec libx265 -crf 34 011_cs_final_crf_34.mp4 | ffplay
-
@meeshu
Add ffplay to your path; or place a copy in your videos folder.
Try this command, exactly as is, change only the input name. [ran successfully on my system]
Code:ffmpeg -hide_banner -i input.mp4 -vcodec libx264 -acodec aac -crf 45 -f mpegts - | ffplay -hide_banner -vf "scale=320:240" -af "volume=0.5" -
p.s. you are missing dashes around the pipe in your code ..
Let's break down the command step by step:
Code:ffmpeg -hide_banner -i input.mp4 -vcodec libx264 -acodec aac -crf 45 -f mpegts -
- `-i input.mp4`: Specifies the input file, `input.mp4`, to be processed.
- `-vcodec libx264`: Sets the video codec to `libx264`, which is a widely used codec for H.264 video encoding.
- `-acodec aac`: Sets the audio codec to `aac`, which is Advanced Audio Coding.
- `-crf 45`: Sets the Constant Rate Factor (CRF) to 45. CRF is a quality factor where lower values mean better quality.
- `-f mpegts`: Specifies the output format as MPEG Transport Stream (MPEG-TS).
- `-`: Indicates that the output should be piped to the next command in the pipeline.
`ffplay` Command
Code:ffplay -hide_banner -vf "scale=320:240" -af "volume=0.5" -
- `-hide_banner`: Suppresses the display of the FFmpeg banner.
- `-vf "scale=320:240"`: Applies a video filter to scale the video to a resolution of 320x240 pixels.
- `-af "volume=0.5"`: Applies an audio filter to set the volume to 50% (0.5).
- `-`: Indicates that the input should be read from the standard input (stdin), which is the output of the `ffmpeg` command.
### Overall Pipeline
1. `ffmpeg` reads `input.mp4`, encodes the video using `libx264` and the audio using `aac`, and sets the CRF to 45.
2. The output is in the MPEG-TS format and is piped to `ffplay`.
3. `ffplay` takes the piped input, scales the video to 320x240 pixels, reduces the audio volume to 50%, and plays the video.Last edited by videoAI; 29th Jun 2025 at 04:45.
As always .. there is nothing wrong with my environment -
-
Thanks for the comments.
The PATH to ffmpeg, ffplay, and ffprobe has already been created within the environment variables (C:\ffmpeg-7.0.2-full_build\bin) where bin contains all three executables.
I have basically given up now on trying to use ffplay to preview video quality adjustments as I just can't get my commands to work despite trying combinations of piping and dashes before and after the pipe.
I'll just have to stick to using ffmpeg only and review the processed videos afterwards; doing things the slow way! -
The bat file I gave you works perfectly if ffmpeg and ffplay are in your search path. If you want to specify the full paths and the path you indicated is correct:
Code:"C:\ffmpeg-7.0.2-full_build\bin\ffmpeg.exe" -i %1 -an -vcodec libx265 -crf 50 -f mpegts - | "C:\ffmpeg-7.0.2-full_build\bin\ffplay.exe" - pause
I used cfr 50 so it would be very obvious that the video was being encoded by x265 -- the picture looks terrible. Obviously, change the crf value to suit your needs.
Similar Threads
-
Using ffplay's command-line options
By couldabin in forum Newbie / General discussionsReplies: 3Last Post: 3rd Jan 2024, 09:08 -
Customize audio visualization in FFplay
By naoto89 in forum Software PlayingReplies: 0Last Post: 5th Nov 2022, 13:42 -
Any way to pipe output of ffplay or VLC *to* ffmpeg?
By RogerTango in forum Video ConversionReplies: 23Last Post: 11th Dec 2021, 12:03 -
Software for checking video corruption
By Xalzor in forum Newbie / General discussionsReplies: 4Last Post: 6th Apr 2021, 19:15 -
ffplay exact examples of how to use.
By oduodui in forum Newbie / General discussionsReplies: 6Last Post: 12th Nov 2020, 13:08