0

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:

INPUT

Output:

OUTPUT

| improve this question | | | | |
  • Add -crf 20 .. – Gyan Jun 12 '18 at 9:09
  • @Gyan why 20? 23 is default, right? And 0 is lossless, so why no 0? – tomsk Jun 12 '18 at 9:11
  • 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 Jun 12 '18 at 9:20
  • @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 Jun 12 '18 at 9:53
  • Remove -c. Unless you have specific needs, remove -copyts as well. – Gyan Jun 12 '18 at 10:20
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
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.