[FFmpeg-user] Re-encode mpeg2 for same quality

petesea at frontier.com petesea at frontier.com
Tue Feb 24 22:20:16 CET 2015


How can I re-encode an mpeg2 video into another mpeg2 video and preserve 
as much of the original detail/quality as possible?

For example, if I do this (full output below):

   $ ffmpeg -i video-ORIG.vob -codec:v mpeg2video -b:v 16384k -maxrate 30000k -bufsize 4096k -codec:a copy -copyts -f vob video-COPY.vob

The "video-COPY.vob" file is about half the size of "video-ORIG.vob" and 
the total bitrate goes from 5010 kb/s down to 2766 kb/s.  This leads me to 
think it must be degrading the quality of the video.

What do I need to do to maintain the same size, shape, bits, pixels... ie 
the same (or as close to as possible) "quality"?

There's 2 main reasons I'd like to do this:

   1. When video-COPY.vob is transferred to my DVR, it plays ok, but has 
problems when fast forward/reverse is used.  If I fast forward then stop, 
the video will skip ahead several minutes.  This is very annoying and 
makes it so FFWD/REV are very unreliable.  When video-ORIG.vob is 
transferred to my DVR it doesn't have any of these problems.

   2. I assume the reduction in size/bitrate means a reduction in the video 
quality.  I want to maintain as much of the original quality as possible.

I suspect one question may be - why am I re-encoding "video-ORIG.vob" into 
a video of the same format if the original works fine.  Right now, I'm 
re-encoding just as test, the final video will only be re-encoded in order 
to add hard subtitles via the overlay filter.  I'm guessing if I can get 
the correct options without the overlay filter they should still apply 
when I use the overlay filter.

I'm not married to ANY of the options I've used... in fact if I could 
(eventually) do something like this:

   $ ffmpeg -i video-ORIG.vob -filter_complex "[0:v][0:s]overlay" -c copy video-HARDSUBS.vob

that would be perfect.  But I know I can't copy the video stream and use 
an overlay filter, so I want to come up with the options that preserve as 
much of the video detail/quality as possible.  I'm also hoping that by 
preserving the quality/detail this will correct the FFWD/REV problems.

-------------------------------------------------------------------------

$ ffmpeg -i video-ORIG.vob -codec:v mpeg2video -b:v 16384k -maxrate 30000k -bufsize 4096k -codec:a copy -copyts -f vob video-COPY.vob
ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
   built on Feb 12 2015 12:31:33 with gcc 4.5.1 (GCC) 20100924 (Red Hat 4.5.1-4)
   configuration: --enable-gpl --enable-version3 --enable-nonfree --disable-static --enable-shared --disable-debug --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-x11grab
   libavutil      54. 15.100 / 54. 15.100
   libavcodec     56. 13.100 / 56. 13.100
   libavformat    56. 15.102 / 56. 15.102
   libavdevice    56.  3.100 / 56.  3.100
   libavfilter     5.  2.103 /  5.  2.103
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
   libpostproc    53.  3.100 / 53.  3.100
Input #0, mpeg, from 'video-ORIG.vob':
   Duration: 02:12:02.98, start: 0.533367, bitrate: 5010 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 9800 kb/s, 29.97 fps, 59.94 tbr, 90k tbn, 59.94 tbc
     Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
Output #0, vob, to 'video-COPY.vob':
   Metadata:
     encoder         : Lavf56.15.102
     Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=2-31, 16384 kb/s, 29.97 fps, 90k tbn, 29.97 tbc
     Metadata:
       encoder         : Lavc56.13.100 mpeg2video
     Stream #0:1: Audio: ac3, 48000 Hz, 5.1(side), 448 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> mpeg2video (native))
   Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=237452 fps= 93 q=2.0 Lsize= 2675912kB time=02:12:03.50 bitrate=2766.6kbits/s dup=47490 drop=0
video:2206637kB audio:433288kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.363188%


$ ffmpeg -hide_banner -i video-COPY.vob
Input #0, mpeg, from 'video-COPY.vob':
   Duration: 02:12:02.98, start: 0.533367, bitrate: 2766 kb/s
     Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 30000 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
     Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
At least one output file must be specified


$ ls -lgG video-ORIG.vob video-COPY.vob
-rw-r--r--. 2 4961927168 Feb 23 10:49 video-ORIG.vob
-rw-r--r--. 1 2740133888 Feb 24 12:58 video-COPY.vob


More information about the ffmpeg-user mailing list