A misadventure to fix a video to stop its console error messages. Unsolved.
Trying mplayer’s MEncoder video encoder. PCLinuxOS has it in the repository:
apt-get install mencoder
https://linuxreviews.org/HOWTO_Convert_video_files#Using_MPlayer_.28mencoder.29
What I tried was:
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -ofps 23.976 \ -oac mp3lame \ -lameopts abr:br=92 \ -ovc xvid \ -xvidencopts pass=2:bitrate=150
Used on:
-
mp4 video
- had a “first frame is no keyframe” error when launching the video.
- When skipping ahead, it would just look blocky and ugly for a while, until it got another keyframe.
It worked, but the file went from 29 to 70 MB!
I see some other options, but I also see “transcode” mentioned. It’s also in the PCLinuxOS repository. It has some dependencies, but everything installs just fine.
apt-get install transcode
Trying it:
transcode -i filename.ext -o movie.avi -y xvid
Spoiler
[export_xvid4.so] v0.0.6 (2007-08-11) (video) XviD 1.0.x series (aka API 4.0) | (audio) MPEG/AC3/PCM [codecinfo] Error: Cannot open plugin directory /usr/lib/libquicktime (forgot make install?) [codecs] Warning: Could not find audio Decoder for fourcc mp4a [codecs] Warning: quicktime_decode_audio_stub called [codecs] Warning: Could not find video Decoder for fourcc avc1 [codecs] Warning: quicktime_decode_video_stub called [import_mov.so] codec=mp4a, rate=22050 Hz, bits=16, channels=2, samples=12603392 error: quicktime audio codec 'mp4a' not supported! audio import module error: OPEN failed
Does not work. It mentions /usr/lib/libquicktime, so I’ll try installing that:
apt-get install libquicktime
It doesn’t complain about the missing library now, but it’s still not a success:
transcode -i filename.ext -o movie.avi -y xvid
Spoiler
[h264 @ 0x8795810]warning: first frame is no keyframe VDec: vo config request - 400 x 304 (preferred colorspace: Planar YV12) VDec: using Planar YV12 as output csp (no 0) Movie-Aspect is 1.33:1 - prescaling to correct movie aspect. videocodec: XviD (400x304 fourcc=44495658 [XVID]) xvid: par=0/0 (vga11), displayed=406x304, sampled=400x304 xvid: you must specify one or a valid combination of 'bitrate', 'pass', 'quantizer' settings FATAL: Cannot initialize video driver. Exiting...
Ok, I’ll try -pass like with MEncoder.
transcode -i filename.ext -o movie.avi -y xvid -pass 2
Spoiler
[import_mov.so] v0.1.2 (2002-05-16) (video) * | (audio) * Audio format not supported by import module [transcode] failed to init import modules
No luck there either. But I can’t find -pass in the manual, so maybe that’s not a real option.
transcode -i filename.ext -o movie.avi -y xvid --lame_preset fast medium
Spoiler
error: quicktime audio codec 'mp4a' not supported! audio import module error: OPEN failed [transcode] critical: failed to open input source
Ok, transcode won’t work. Back to MPlayer/MEncoder. I did some fiddling around to remove my specifying bitrates. Maybe it’ll keep the original settings. I should end up with a file size that’s nearly the same and maybe smaller and a quality that’s nearly the same.
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -ofps 23.976 \ -oac mp3lame \ -ovc xvid \ -xvidencopts pass=1
From 29 to 76 MB. Boo. Let’s remove -ofps and retry.
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -oac mp3lame \ -ovc xvid \ -xvidencopts pass=1
I got only one “Skipping frame!” message, and no duplicate frame messages like before.
From 29 to 78 MB! Oh man. Ok, so I should play with the codecs or something. While -oac copy couldn’t work with -ovc copy, it did recommend -oac pcm so I’ll try that:
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -oac pcm \ -ovc copy \ -xvidencopts pass=1
From 29 to 127 MB! I found out that pcm is uncompressed. Let’s try mp3lame. Actually I’d rather find a more free codec, but there was no better option.
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -oac mp3lame \ -ovc copy \ -xvidencopts pass=1
From 29 to 33 MB. WOOHOO! But now I can’t skip ahead in the video. Playing with -idx didn’t work, and re-encoding with -forceidx didn’t change anything.
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -oac mp3lame \ -ovc copy \ -xvidencopts pass=1 \ -noidx
Works. Same good file size. Skipping ahead works, but the video is blurry for several seconds. It’s not really fixing the problem..
Uh, what the. I tried the previous non -noidx and when I played the video I tried -forceidx and it plays and skips, but it’s mangled and it gives that damned popup keyframe warning still. Bah! Let’s try this:
nice -n 19 \ mencoder filename.ext \ -o destination_filename.avi \ -oac mp3lame \ -ovc copy \ -idx
Nope. Trying -forceidx doesn’t work either. What the fuck.
I might be able to transcode the video then transplant the audio somehow. So much work to figure that out.. sigh.
mencoder -idx destination_filename.avi -ovc copy -oac copy -o destination_filename2.avi
Nope.
Ok, fuck this. I’ll suppress messages:
gmplayer -msglevel all=0
