Howdy - When is 80% of something about equal to 100%?
Now that I've got your attention ... ;) Ordinarily you would expect that encoding fewer frames would result in a .m2v file that was smaller than encoding more frames. Right? That's not what I am seeing and it's very puzzling. What I did was take a ~88min capture from a tape that was known to have originated on film. The data was captured as 8bit uncompressed (in case you're curious that's about 105GB ;)). Stepping thru the frames the 2:3 telecine pattern is obvious so using 'yuvkineco -F 1' would work nicely. Without any 3:2 removal the 158065 frames encoded to a ~30fps movie with an average bitrate of ~6229Kb/s: -------------- #!/bin/sh N=sinbad ~sms/qt2raw /Volumes/LaCie/tmp/$N.mov | \ yuv4mpeg -w 720 -h 486 -x 422 -a 10:11 -i b -r 30000:1001 | \ y4mscaler -v 0 -I active=704x480+8+2 -O sar=src -O size=704x480 | \ yuvmedianfilter -f -t 0 -r 1 -w 12 | \ y4mdenoise -I 0 -t 3 -z 2 -m 30 -M 3 | \ y4mscaler -v 0 -O sar=src -O chromass=420_MPEG2 | \ bfr -b 20m | \ mpeg2enc -D 10 -G 15 -b 6400 -c --dualprime-mpeg2 -E -10 -f 8 -q 2 -K tmpgenc -4 1 -2 1 -o $N.m2v ---------------------- (the 'qt2raw' program is a local work of art that can extract 8bit uncompressed D1 (720x486) data from a Quicktime file and emit 4:2:2 planar data) The "ls -l" + "mplex" summary of the 30fps encoding: 30fps (-R 0 --dualprime-mpeg2) -rw-r--r-- 1 sms sms 4106845567 Jun 14 05:29 sinbad-30R0dp.m2v INFO: [mplex] No. Pictures : 158065 INFO: [mplex] No. Groups : 10538 INFO: [mplex] No. I Frames : 10538 avg. size 61285 bytes INFO: [mplex] No. P Frames : 147527 avg. size 23460 bytes INFO: [mplex] No. B Frames : 0 avg. size 0 bytes INFO: [mplex] Average bit-rate : 6229600 bits/sec INFO: [mplex] Peak bit-rate : 6896400 bits/sec Nice bitrate, good looking video. Converting to 24000/1001 progressive (undoing the telecine ) reduces the number of frames by 20% so the filesize/bitrate should go down (and leave room on the DVD for a few extras). Correct? 20% fewer frames should mean a smaller file, right? So, 'yuvcorrect' (to convert to a top field first stream) and "yuvkineco -F 1" were added to the pipeline and the "-p" option given to 'mpeg2enc': -------------------- #!/bin/sh N=sinbad ~sms/qt2raw /Volumes/LaCie/tmp/$N.mov | \ yuv4mpeg -w 720 -h 486 -x 422 -a 10:11 -i b -r 30000:1001 | \ yuvcorrect -v 0 -T TOP_FORWARD -T INTERLACED_TOP_FIRST | \ y4mscaler -v 0 -I active=704x480+8+2 -O sar=src -O size=704x480 | \ yuvmedianfilter -f -t 0 -r 1 -w 12 | \ yuvkineco -F 1 -C yuvkineco.txt | \ y4mdenoise -I 0 -t 3 -z 2 -m 30 -M 3 | \ y4mscaler -v 0 -O sar=src -O chromass=420_MPEG2 | \ bfr -b 20m | \ mpeg2enc -D 10 -G 15 -b 6400 -p -c -R 2 -E -10 -f 8 -q 2 -K tmpgenc -4 1 -2 1 -o $N.m2v ---------------------- The encoded file is LESS THAN 1% smaller than just encoding the ~30fps capture without change! 24fps with 3:2 (-p -R 2) -rw-r--r-- 2 sms sms 4070777716 Jun 13 10:07 sinbad-24R2.m2v INFO: [mplex] No. Pictures : 126450 INFO: [mplex] No. Groups : 8430 INFO: [mplex] No. I Frames : 8430 avg. size 66178 bytes INFO: [mplex] No. P Frames : 42150 avg. size 38428 bytes INFO: [mplex] No. B Frames : 75870 avg. size 24952 bytes INFO: [mplex] Average bit-rate : 6174800 bits/sec INFO: [mplex] Peak bit-rate : 6893600 bits/sec So with 20% fewer frames encoded why is the output file almost identical in size??? To see if not using B frames would make a difference the same 24fps encoding above was done again but "-R 2" changed to "-R 0": 24fps with 3:2 (-p -R 0) -rw-r--r-- 1 sms sms 4042399041 Jun 15 01:21 sinbad-24R0.m2v INFO: [mplex] No. Pictures : 126450 INFO: [mplex] No. Groups : 8430 INFO: [mplex] No. I Frames : 8430 avg. size 65807 bytes INFO: [mplex] No. P Frames : 118020 avg. size 29551 bytes INFO: [mplex] No. B Frames : 0 avg. size 0 bytes INFO: [mplex] Average bit-rate : 6131600 bits/sec INFO: [mplex] Peak bit-rate : 7050000 bits/sec As usual leaving out the B frames produced a smaller file ;) True, the difference is modest but there are times when an extra 30MB on a DVD project makes the difference between fitting and not fitting on the media. Just one last test to run - that's the 30fps (no telecine removal) using "-R 2" (instead of -R 0/--dualprime). -------------- #!/bin/sh N=sinbad ~sms/qt2raw /Volumes/LaCie/tmp/$N.mov | \ yuv4mpeg -w 720 -h 486 -x 422 -a 10:11 -i b -r 30000:1001 | \ y4mscaler -v 0 -I active=704x480+8+2 -O sar=src -O size=704x480 | \ yuvmedianfilter -f -t 0 -r 1 -w 12 | \ y4mdenoise -I 0 -t 3 -z 2 -m 30 -M 3 | \ y4mscaler -v 0 -O sar=src -O chromass=420_MPEG2 | \ bfr -b 20m | \ mpeg2enc -D 10 -G 15 -b 6400 -c -R 2 -E -10 -f 8 -q 2 -K tmpgenc -4 1 -2 1 -o $N.m2v ---------------------- 30fps (-R 2) -rw-r--r-- 1 sms sms 4129566072 Jun 15 20:11 sinbad-30R2.m2v INFO: [mplex] No. Pictures : 158065 INFO: [mplex] No. Groups : 10538 INFO: [mplex] No. I Frames : 10538 avg. size 60002 bytes INFO: [mplex] No. P Frames : 52689 avg. size 31916 bytes INFO: [mplex] No. B Frames : 94838 avg. size 19144 bytes INFO: [mplex] Average bit-rate : 6263600 bits/sec INFO: [mplex] Peak bit-rate : 7085600 bits/sec ~2% larger than the smallest of the encodings (which was the 24 fps -R0 one). Hardly seems worth the cpu cycles to do the telecine removal. Anyone care to guess why encoding 20% fewer frames gives the same file size as encoding all of the frames? Cheers, Steven Schultz ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click _______________________________________________ Mjpeg-users mailing list Mjpeg-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mjpeg-users