0

I'm using FFmpeg in my program to cut a video. This is the command my program executed:

ffmpeg -i in.avi -ss 00:00:00.000 -to 00:04:35.000 out.avi

Quality and size of out.avi are MUCH lower than in.avi. How can I tell FFmpeg to keep the quality of the input file? I don't want to use -c copy because then the video will start with black frames.

Here is the output without -c copy (command above) http://pastebin.com/JYYRsFsQ

Here is the output of the command with -c copy ffmpeg -i in.avi -ss 00:00:05.000 -c copy -to 00:04:35.000 out.avi

output with -c copy: http://pastebin.com/wXPhBSYj

Nocta
  • 199
  • 2
  • 9
  • Please include the `ffmpeg` command and complete console output from the command that uses `-c copy`. Do all players show the black frames? – llogan Feb 15 '15 at 03:15
  • I included both commands and their output now. I only tested VLC which shows black frames, but plays the sound. I think it is because there is no key frame at second 5 (where I start cutting). It is black for like 3 to 4 seconds. VLC is the only player I care about so no use to test any other. – Nocta Feb 15 '15 at 10:42

2 Answers2

0

I use ffmpeg -i inFile -c:v libx264 -preset veryfast -c:a copy -ss starttime -to endtime outFile now. It seems to encode the video in good quality and reasonable size (exactly what you'd expect from libx264).

Nocta
  • 199
  • 2
  • 9
0

Use -codec copy

https://ffmpeg.org/ffmpeg.html#Stream-copy

Stream copy just does muxing operations without encoding. The quality changes come from differences in encoding, lower bitrate/audio sample rate.

Example of this command:

ffmpeg -i in.avi -ss 00:00:00.000 -to 00:04:35.000 -codec copy out.avi

axecopfire
  • 512
  • 5
  • 16