<p>Lossy codecs such as x264 degrade the image quality by design, if you don't want to lose image quality you either have to use a lossless codec or better yet, not re-encode at all.</p>

<p>I assume the source material is either H.264 or MPEG-2, so the best solution in your case would be to simply copy all the streams into the new container:</p>

<pre><code>ffmpeg -i input.flv -c copy output.mp4
</code></pre>

<p>Here's the command for using x264's lossless mode if you <em>have to</em> re-encode for whatever reason:</p>

<pre><code>ffmpeg -i input.flv -c:a copy -c:v libx264 -crf 0 output.mp4
</code></pre>

CC BY-SA 4.0
2018-06-20T14:21:30.337Z
2018-06-20T14:21:30.337Z
Atemu
<p>Please higher your <code>-minrate, -maxrate, -bufsize</code> and study its codec. Download the Better container for video codec and audio codec separately. encode the codec in these containers but follow these steps:</p>
<p><strong>1. Download the audio and video separately. you can do this by adding -vn and -an on the output command line. -vn means 'no video' while -an means 'no audio'. After that, study the codec of video or audio, and encode it to its better container... Here are the best container for modern codecs.</strong></p>
<pre><code>&quot;Audio/Video codec&quot;

*AAC/H264 is better on (TS)
*OPUS is better on (MKV)
*VP9 is better on (AVI)
</code></pre>
<p><strong>2. After downloading the video/audio separately, you need to merge them together of course. Please include your said -minrate, -maxrate, and -bufsize. Don't forget to study your codecs and join them together with these containers:</strong></p>
<pre><code>&quot;Merging&quot;

*Mixing VP9 and OPUS is better on (MKV)
*Mixing H264 and AAC is better on (MOV)
*otherwise most incompatible codec is better on (MKV)
</code></pre>

CC BY-SA 4.0
2021-02-19T19:01:04.047Z
2021-02-19T19:01:04.047Z
Jefferson Josol
<p>I need to convert flv video into mp4 video, so I used this command:</p>

<pre><code>ffmpeg -i input.flv -c -vcodec libx264 -acodec copy output.mp4
</code></pre>

<p>But output video has little bit worse video quality, how can I fix it?</p>

<p>MP4 info (output):</p>

<ul>
<li>video: 472kb/s bitrate, 680*480, 24 FPS</li>
<li>audio: 112kb/s bitrate, 44.1 kHz, mpeg audio, stereo</li>
</ul>

<p>FLV info (input):</p>

<ul>
<li>video: 1500kb/s bitrate, 680*480, 24 FPS</li>
<li>audio: 112kb/s bitrate, 44.1 kHz, mpeg audio, stereo</li>
</ul>

<p><strong>UPDATE:</strong></p>

<p>I tried with <code>-crf 18</code> and this is result (colors of output are more bright and look at that yellow line on the cap, on the output image that yellow line contains  something like noise).</p>

<p>Input:</p>

<p><a href="https://i.sstatic.net/R2XMr.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/R2XMr.jpg" alt="INPUT"></a></p>

<p>Output:</p>

<p><a href="https://i.sstatic.net/U4o8e.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/U4o8e.jpg" alt="OUTPUT"></a></p>

CC BY-SA 4.0
2018-06-12T09:09:45.770Z
Add `-crf 20` ..
Gyan
CC BY-SA 4.0
2018-06-12T09:11:24.000Z
@Gyan why 20? 23 is default, right? And 0 is lossless, so why no 0?
tomsk
CC BY-SA 4.0
2018-06-12T09:20:15.197Z
`0` output isn't compatible with most players. Low CRF offers diminishing returns. `18` is considered visually lossless, but you don't need to try that first.
Gyan
CC BY-SA 4.0
2018-06-12T09:53:49.363Z
@Gyan What is wrong with this command 
    ffmpeg -i input.flv -crf 20 -c -vcodec libx264 -acodec copy -copyts output.mp4? I get an error: Unable to find a suitable output format for 'libx264'
tomsk
CC BY-SA 4.0
2018-06-12T10:20:37.517Z
Remove `-c`. Unless you have specific needs, remove `-copyts` as well.
Gyan
CC BY-SA 4.0
2018-06-12T10:26:37.557Z
@Gyan -c is codec right? And why remove copyts? It just copy timestamp, what is it good for?
tomsk
CC BY-SA 4.0
2018-06-12T10:42:36.733Z
You have not set a value for `-c` and already specified vcodec and acodec so not required. copyts may lead to mux issues depending on output vsync.
Gyan
CC BY-SA 4.0
2018-06-12T11:17:16.313Z
@Gyan thank you, by mux issues do you mean that video and audio can be not sync? Look at updated question.
tomsk
CC BY-SA 4.0
2018-06-14T05:27:04.427Z
Not sync directly, but timestamp fidelity and drop/dup decisions if source timebase and output timebase have much different resolutions.
Gyan
CC BY-SA 4.0
2018-06-14T05:27:45.930Z
As far as the color is concerned, looks like the source is full range and the output is flagged or treated as limited range.
Gyan
<ffmpeg><mp4><quality><flash>
Low conversion quality using ffmpeg
tomsk
# Low conversion quality using ffmpeg

(Asked by: username_0 on 2018-06-12)

I need to convert flv video into mp4 video, so I used this command:
ffmpeg -i input.flv -c -vcodec libx264 -acodec copy output.mp4

But output video has little bit worse video quality, how can I fix it?
MP4 info (output):

video: 472kb/s bitrate, 680*480, 24 FPS
audio: 112kb/s bitrate, 44.1 kHz, mpeg audio, stereo

FLV info (input):

video: 1500kb/s bitrate, 680*480, 24 FPS
audio: 112kb/s bitrate, 44.1 kHz, mpeg audio, stereo

UPDATE:
I tried with -crf 18 and this is result (colors of output are more bright and look at that yellow line on the cap, on the output image that yellow line contains  something like noise).
Input:

Output:

**Tags:** ffmpeg, mp4, quality, flash

> **Comments:**
> **username_1**: Add `-crf 20` ..  
> **username_0**: @username_1 why 20? 23 is default, right? And 0 is lossless, so why no 0?  
> **username_1**: `0` output isn't compatible with most players. Low CRF offers diminishing returns. `18` is considered visually lossless, but you don't need to try that first.  
> **username_0**: @username_1 What is wrong with this command      ffmpeg -i input.flv -crf 20 -c -vcodec libx264 -acodec copy -copyts output.mp4? I get an error: Unable to find a suitable output format for 'libx264'  
> **username_1**: Remove `-c`. Unless you have specific needs, remove `-copyts` as well.  
> **username_0**: @username_1 -c is codec right? And why remove copyts? It just copy timestamp, what is it good for?  
> **username_1**: You have not set a value for `-c` and already specified vcodec and acodec so not required. copyts may lead to mux issues depending on output vsync.  
> **username_0**: @username_1 thank you, by mux issues do you mean that video and audio can be not sync? Look at updated question.  
> **username_1**: Not sync directly, but timestamp fidelity and drop/dup decisions if source timebase and output timebase have much different resolutions.  
> **username_1**: As far as the color is concerned, looks like the source is full range and the output is flagged or treated as limited range.  

---

## 2 answers

### Answer by username_2 on 2018-06-20. Score: 1

Lossy codecs such as x264 degrade the image quality by design, if you don't want to lose image quality you either have to use a lossless codec or better yet, not re-encode at all.
I assume the source material is either H.264 or MPEG-2, so the best solution in your case would be to simply copy all the streams into the new container:
ffmpeg -i input.flv -c copy output.mp4

Here's the command for using x264's lossless mode if you have to re-encode for whatever reason:
ffmpeg -i input.flv -c:a copy -c:v libx264 -crf 0 output.mp4


---

### Answer by username_3 on 2021-02-19. Score: 0

Please higher your -minrate, -maxrate, -bufsize and study its codec. Download the Better container for video codec and audio codec separately. encode the codec in these containers but follow these steps:
1. Download the audio and video separately. you can do this by adding -vn and -an on the output command line. -vn means 'no video' while -an means 'no audio'. After that, study the codec of video or audio, and encode it to its better container... Here are the best container for modern codecs.
"Audio/Video codec"

*AAC/H264 is better on (TS)
*OPUS is better on (MKV)
*VP9 is better on (AVI)

2. After downloading the video/audio separately, you need to merge them together of course. Please include your said -minrate, -maxrate, and -bufsize. Don't forget to study your codecs and join them together with these containers:
"Merging"

*Mixing VP9 and OPUS is better on (MKV)
*Mixing H264 and AAC is better on (MOV)
*otherwise most incompatible codec is better on (MKV)


---

