Post subject: Keeping the video uncompressed
GabCM
He/Him
Joined: 5/5/2009
Posts: 901
Location: QC, Canada
Hello there. I already encoded a run now. Instead of using codecs such as H.264 lossless and FFV1, I don't even compress the video, to keep the quality as high as possible. I have a question about combining the recording, the logo and the subtitles. This is the actual batch script I use.
start /wait mencoder.exe -oac copy -mc 0 -vf flip -font subfont.ttf -nofontconfig -ovc lavc -sub subtitle.sub -subfont-text-scale 4 -subfont-outline 4 -o mixed.avi logo.avi recorded.avi
By the way, there's a long story behind the inclusion of -vf flip. After I run that batch script, I see that the video is compressed and that the quality is lowered a bit. Is there a way to avoid the compression? Like a command I can add or something like that. I only want to compress when I get to convert the AVI into an MP4. (I'm not perfect in English)
Joined: 11/4/2007
Posts: 1772
Location: Australia, Victoria
Uh, as far as I can gather, what you're seeing happen is colourspace reduction... though, my MEncoder skills are less than optimal. Grunt, help here, please! *hinthintnudgenudge* But I do feel that I need to inform you that Uncompressed video doesn't exactly heighten the quality. There is a reason that every single screenshot I've made for TASVideos in recent times has come from a frame from one of my raw CamStudio codec dumps... it's 100% lossless, despite being compressed. Similarly, FFV1 can compress into RGB32 much in the same way CamStudio codec does. But the thing is, they all must be converted to the YV12 colourspace for encoding. Yes, raw uncompressed RGB32 video can achieve the same result as CamStudio codec... but it isn't worth the space wastage. For me, it's actually faster to dump into the CamStudio codec because my Hard Drive is so slow... that, and I lack the capacity to process uncompressed video.
sgrunt
He/Him
Emulator Coder, Former player
Joined: 10/28/2007
Posts: 1360
Location: The dark horror in the back of your mind
Mister Epic wrote:
-ovc lavc
You're specifying this in the absence of any
-lavcopts
option; I don't recall what the default settings are but they are rather lossy. I'd suggest specifying
-lavcopts vcodec=ffv1:format=bgr32
, which will give you FFV1 lossless video which would work extremely well for subsequent steps. If you really want to continue using uncompressed video, specify
-ovc raw
instead of
-ovc lavc
. EDIT: By the way, if ffdshow isn't working for you for ripping (as I remember from earlier), try using another lossless RGB codec such as the Camstudio codec (which mencoder will happily accept as an input). EDIT2: As Warp says below, if you are using a lossless RGB codec, you will see absolutely no loss in visual quality from step to step.
Post subject: Re: Keeping the video uncompressed
Banned User
Joined: 3/10/2004
Posts: 7698
Location: Finland
Mister Epic wrote:
Instead of using codecs such as H.264 lossless and FFV1, I don't even compress the video, to keep the quality as high as possible.
Nitpicking, but there is no image quality difference between lossless compression and uncompressed video. That's what the term "lossless" means in the first place. (Of course it might be that "H.264 lossless" isn't lossless after all, unlike the name implies...)
Post subject: Re: Keeping the video uncompressed
sgrunt
He/Him
Emulator Coder, Former player
Joined: 10/28/2007
Posts: 1360
Location: The dark horror in the back of your mind
Warp wrote:
(Of course it might be that "H.264 lossless" isn't lossless after all, unlike the name implies...)
h.264 lossless will cause a colorspace conversion to YV12, so it isn't lossless relative to the original input.
Player (36)
Joined: 9/11/2004
Posts: 2630
moreover, I was under the impression that H.264 lossless still sent every block through a DCT to compress it, if that's the case then it's as lossless as a full quality .jpg
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
GabCM
He/Him
Joined: 5/5/2009
Posts: 901
Location: QC, Canada
Thanks for you suggestions! I'm gonna use FFV1 and the Camstudio lossless codec.
Publisher
Joined: 4/23/2009
Posts: 1283
OmnipotentEntity wrote:
moreover, I was under the impression that H.264 lossless still sent every block through a DCT to compress it, if that's the case then it's as lossless as a full quality .jpg
I don't think so. I think H.264 lossless is truly lossless in the YV12 colorspace (for x264 that is)
Player (36)
Joined: 9/11/2004
Posts: 2630
Aktan wrote:
OmnipotentEntity wrote:
moreover, I was under the impression that H.264 lossless still sent every block through a DCT to compress it, if that's the case then it's as lossless as a full quality .jpg
I don't think so. I think H.264 lossless is truly lossless in the YV12 colorspace (for x264 that is)
I just tested with some very noisy video, it is indeed lossless when compared to ffv1 when colorspace is equal. Tested with the following script:
rm s.log; mkfifo s.log; /home/omnipotententity/coding/mplayer-src/mplayer/mencoder -nosound -vf format=bgr32 -ovc raw -of rawvideo -ofps 60.000 -o s.log -quiet "dump_part39.avi" & /home/omnipotententity/coding/x264-src/x264/x264 s.log --crf 0 --preset placebo --fps 60.000 --threads 1 --output "encoding-test.mp4" 256x224
#intentionally used the wrong format to get very noisy difficult to compress video
rm s.log; mkfifo s.log; /home/omnipotententity/coding/mplayer-src/mplayer/mencoder -nosound -vf format=bgr32 -ovc raw -of rawvideo -ofps 60.000 -o s.log -quiet "dump_part39.avi" & mencoder -demuxer rawvideo -rawvideo fps=60.000:w=256:h=224:format=iyuv -ovc lavc -lavcopts vcodec=ffv1:vstrict=-2 -o encoding-test.avi s.log
#mimicking how x264 expects video
mkdir h264
cd h264
mplayer ../encoding-test.mp4 -vo png:z=0
cd ..
mkdir ffv1
cd ffv1
mplayer ../encoding-test.avi -vo png:z=0
cd ..
for i in {100..499}
do
diff -q h264/*$i.png ffv1/*$i.png
done
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Publisher
Joined: 4/23/2009
Posts: 1283
Cool, you've verified it =)