[FFmpeg-user] Re-encode mpeg2 for same quality
petesea at frontier.com
petesea at frontier.com
Wed Feb 25 01:28:18 CET 2015
On Tue, 24 Feb 2015, Carl Eugen Hoyos wrote:
> Use -qscale 2 -mbd 2 (or qscale 1).
I tried using "-qscale:v 1 -mbd 2" and "-qscale:v 2 -mbd 2" but neither
made much of a difference. qscale:v 1 helped a little but not much. See
full results below.
> Why are you using -copyts?
To be honest, I'm not sure. I believe I found a case once (or twice)
where it fixed something and I've just been using it ever since. It
didn't seem to cause any problems, so I just kept using it. I'll try
removing it.
> This seems missing the -target option afaict. If you use it, I believe
> you should not use
I'm not sure which target value I should use... the output doesn't need to
be strictly dvd compliant (at least I don't think so). At any rate, the
"ntsc-dvd" and "film-dvd" would seem to be the most likely options, so i
did a couple runs using those. Neither helped... in fact they were both
worse in terms of file size/bitrate.
For testing purposes I switched to a small video which is just a 15 sec
chunk of the original video. And while this size video is too small to
test the DVR (FFWD/REW) issues, I do see the same kind of file size and
bitrate reduction. Using the smaller video just makes it easier/quicker to
run lots of tests using different options.
Here's a small table with what I found using -qscale:v, -mbd and -target
(full output below). The 1st 3 runs use the following options (I removed
-copyts):
-codec:v mpeg2video
-b:v 16384k
-maxrate 30000k
-bufsize 4096k
-codec:a copy
-f vob
The last 2 (-target) do not use -b:v, -maxrate or -bufsize.
Video File Size Bitrate FPS TBR TBN TBC
-------------------------------------------------------------------------------
Original (Small 15 sec) 8771584 4685 29.97 59.94 90k 59.94
Copy 1 3477504 1852 29.97 29.97 90k 59.94
Copy 2 (qscale:v 1 mbd 2) 3584000 1909 29.97 29.97 90k 59.94
Copy 3 (qscale:v 2 mbd 2) 3446784 1836 29.97 29.97 90k 59.94
Copy 4 (target ntsc-dvd) 3248128 1730 29.97 29.97 90k 59.94
Copy 5 (target film-dvd) 3010560 1604 23.98 23.98 90k 47.95
-------------------------------------------------------------------------------
Small (15 sec) piece of original file using original re-encoding options
-------------------------------------------------------------------------------
$ ffmpeg -hide_banner -i video-SMALL.vob -codec:v mpeg2video -b:v 16384k -maxrate 30000k -bufsize 4096k -codec:a copy -f vob video-COPY-1.vob
Input #0, mpeg, from 'video-SMALL.vob':
Duration: 00:00:14.98, start: 0.513067, bitrate: 4685 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-1.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= 450 fps=105 q=2.0 Lsize= 3396kB time=00:00:14.98 bitrate=1856.9kbits/s dup=95 drop=0
video:2526kB audio:819kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.512750%
$ ffmpeg -hide_banner -i video-COPY-1.vob
Input #0, mpeg, from 'video-COPY-1.vob':
Duration: 00:00:15.02, start: 0.533367, bitrate: 1852 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
-------------------------------------------------------------------------------
qscale 1, mbd 2
-------------------------------------------------------------------------------
$ ffmpeg -hide_banner -i video-SMALL.vob -codec:v mpeg2video -b:v 16384k -maxrate 30000k -bufsize 4096k -qscale:v 1 -mbd 2 -codec:a copy -f vob video-COPY-2-q1-mbd2.vob
Input #0, mpeg, from 'video-SMALL.vob':
Duration: 00:00:14.98, start: 0.513067, bitrate: 4685 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-2-q1-mbd2.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= 450 fps= 70 q=1.0 Lsize= 3500kB time=00:00:14.98 bitrate=1913.8kbits/s dup=95 drop=0
video:2629kB audio:819kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.496967%
$ ffmpeg -hide_banner -i video-COPY-2-q1-mbd2.vob
Input #0, mpeg, from 'video-COPY-2-q1-mbd2.vob':
Duration: 00:00:15.02, start: 0.533367, bitrate: 1909 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
-------------------------------------------------------------------------------
qscale 2, mbd 2
-------------------------------------------------------------------------------
$ ffmpeg -hide_banner -i video-SMALL.vob -codec:v mpeg2video -b:v 16384k -maxrate 30000k -bufsize 4096k -qscale:v 2 -mbd 2 -codec:a copy -f vob video-COPY-3-q2-mbd2.vob
Input #0, mpeg, from 'video-SMALL.vob':
Duration: 00:00:14.98, start: 0.513067, bitrate: 4685 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-3-q2-mbd2.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= 450 fps= 71 q=2.0 Lsize= 3366kB time=00:00:14.98 bitrate=1840.5kbits/s dup=95 drop=0
video:2496kB audio:819kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.530087%
$ ffmpeg -hide_banner -i video-COPY-3-q2-mbd2.vob
Input #0, mpeg, from 'video-COPY-3-q2-mbd2.vob':
Duration: 00:00:15.02, start: 0.533367, bitrate: 1836 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
-------------------------------------------------------------------------------
target ntsc-dvd
-------------------------------------------------------------------------------
$ ffmpeg -hide_banner -i video-SMALL.vob -target ntsc-dvd -codec:v mpeg2video -codec:a copy -f vob video-COPY-4-target-ntscdvd.vob
Input #0, mpeg, from 'video-SMALL.vob':
Duration: 00:00:14.98, start: 0.513067, bitrate: 4685 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-4-target-ntscdvd.vob':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=2-31, 6000 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= 450 fps=105 q=2.0 Lsize= 3172kB time=00:00:14.98 bitrate=1734.5kbits/s dup=95 drop=0
video:2305kB audio:819kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.540015%
$ ffmpeg -hide_banner -i video-COPY-4-target-ntscdvd.vob
Input #0, mpeg, from 'video-COPY-4-target-ntscdvd.vob':
Duration: 00:00:15.02, start: 0.533367, bitrate: 1730 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 9000 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
-------------------------------------------------------------------------------
target film-dvd
-------------------------------------------------------------------------------
$ ffmpeg -hide_banner -i video-SMALL.vob -target film-dvd -codec:v mpeg2video -codec:a copy -f vob video-COPY-5-target-filmdvd.vob
Input #0, mpeg, from 'video-SMALL.vob':
Duration: 00:00:14.98, start: 0.513067, bitrate: 4685 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-5-target-filmdvd.vob':
Metadata:
encoder : Lavf56.15.102
Stream #0:0: Video: mpeg2video, yuv420p, 720x480 [SAR 32:27 DAR 16:9], q=2-31, 6000 kb/s, 23.98 fps, 90k tbn, 23.98 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= 360 fps= 96 q=2.0 Lsize= 2940kB time=00:00:14.97 bitrate=1608.2kbits/s dup=5 drop=0
video:2077kB audio:819kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.527211%
$ ffmpeg -hide_banner -i video-COPY-5-target-filmdvd.vob
Input #0, mpeg, from 'video-COPY-5-target-filmdvd.vob':
Duration: 00:00:15.01, start: 0.541711, bitrate: 1604 kb/s
Stream #0:0[0x1e0]: Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 9000 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Stream #0:1[0x80]: Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s
At least one output file must be specified
-------------------------------------------------------------------------------
File Sizes
-------------------------------------------------------------------------------
$ ls -lgG video-SMALL.vob video-COPY-1.vob video-COPY-2-q1-mbd2.vob video-COPY-3-q2-mbd2.vob video-COPY-4-target-ntscdvd.vob video-COPY-5-target-filmdvd.vob
-rw-r--r--. 2 8771584 Feb 23 10:57 video-SMALL.vob
-rw-r--r--. 1 3477504 Feb 24 15:09 video-COPY-1.vob
-rw-r--r--. 1 3584000 Feb 24 15:07 video-COPY-2-q1-mbd2.vob
-rw-r--r--. 1 3446784 Feb 24 15:07 video-COPY-3-q2-mbd2.vob
-rw-r--r--. 1 3248128 Feb 24 15:55 video-COPY-4-target-ntscdvd.vob
-rw-r--r--. 1 3010560 Feb 24 15:56 video-COPY-5-target-filmdvd.vob
-------------------------------------------------------------------------------
FFMPEG Version
-------------------------------------------------------------------------------
$ ffmpeg
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
More information about the ffmpeg-user
mailing list