Log in

View Full Version : Glitch frames converting H.264 to MOV


tygerbug
11th October 2012, 15:06
http://orangecow.org/thief/glitchframe.jpeg
http://orangecow.org/thief/glitchframe-1.jpeg
http://orangecow.org/thief/glitchframe-2.jpeg
http://orangecow.org/thief/glitchframe-3.jpeg
http://orangecow.org/thief/glitchframe-4.jpeg

Hi. I've been working with Doom9 forum member Emulgator on restoring a film called The Thief and the Cobbler, which I originally restored in 2006. The new fourth version is going to be a much higher standard.

Emulgator filtered two versions of the film and saved them as MKVs.

Format H.264, 720x480 (Cinemascope ratio), 23.976 FPS. Audio was AC3.

I need to convert to .MOV format for editing. I've tried converting to the ProRes 422 codec as well as the PhotoJPEG codec I used originally.

After converting, glitch frames appear throughout the film. These are also seen if playing the clip via Perian.

Glitch frames appear in the exact same places in the film each time. This has been the result after converting in Quicktime 7.6.6, Compressor [FCP7], MPEG Streamclip and Perian.

PM me if you'd like to look at a copy of the film for conversion.

Guest
11th October 2012, 15:16
Did you ever get the clean files on BD from Peter C?

Regarding this transcode from MKV, what was your process, including script, encoder, etc.?

tygerbug
11th October 2012, 15:24
Good memory!

No, I never got the clean Blu-Ray files from Peter C, but the MKV files he sent (of that 10 minutes or so of HD footage) were good enough quality for my purposes (the transfer was sort of soft anyway). An HD German trailer also turned up! It was scanned at 5k although I "only" have the 1080p version. Very sharp, if too dark in places.

http://www.youtube.com/watch?v=htuXCAQ6VsE
http://orangecow.org/board/viewtopic.php?f=2&t=1199&start=2520#p19767

I wish I had the Blu-Ray HD files for A Christmas Carol actually. I should bug him about that, maybe. I merely downloaded the thing from Youtube, big black bars at the sides and all.

The MKV material was remuxed into an MP4 container using Subler. There was no recompression.

Results with glitch frames are exactly the same whether converting from the MKV or the remuxed MP4.

I'm running OSX 10.8.2 on PC hardware.

Guest
11th October 2012, 17:04
Oy, Mac! Can't help you with that. I would have suggested to remux with ffmpeg.

Moving thread to Mac forum as it's not really on topic for MPEG4 AVC forum.

tygerbug
11th October 2012, 17:09
I doubt it's a Mac-specific problem. Hope this thread doesn't die a death here ...

How would FFMPEG give a different result than the passthrough remuxing done in Subler? I suppose it's another program to try in terms of format conversion, although I don't understand command-line work and I've been unimpressed with the GUI program FFMpegX in the past.

I can now verify that the versions of the workprint also have glitch frames.

Glitch frames do not appear when playing either the MKV or remuxed MP4 in VLC. They do appear when playing either file in MPEG Streamclip. Quicktime 7 plays the MP4 without glitch frames, but can't convert it without glitch frames.

FFMPEGX is useless, offering no decent formats to convert the material to. I'm sure the command-line FFMpeg can do quite a bit if I knew the right thing to type in.

Guest
11th October 2012, 18:23
If you have a different forum in mind please advise, but not MPEG4 AVC.

tygerbug
11th October 2012, 18:24
But the format of the file is H.264, aka MPEG4 AVC. That's exactly the problem.

Guest
11th October 2012, 18:32
Glitch frames do not appear when playing either the MKV or remuxed MP4 in VLC. They do appear when playing either file in MPEG Streamclip. Quicktime 7 plays the MP4 without glitch frames, but can't convert it without glitch frames. Your evidence does not suggest a problem in the AVC stream but rather in your converter and/or player. If you insist, I will move it back there, but I doubt you'll get anything useful there. Up to you.

tygerbug
11th October 2012, 19:00
Maybe you're right.

FFMPEGX doesn't allow you to convert to any editable codec as far as I can see. I asked FFMPEGX to pass-through the video to an AVI. I used some elements of the DVD setting to get the frame size correct.

It took that literally and seems to have converted Arabian Knight (very quickly!) to DVD format, rather than doing a passthrough.

No glitch frames though- it's a nice encode. That bodes well for using the command line FFMpeg for conversion, if I knew what to type in.

Guest
11th October 2012, 19:18
Try this:

ffmpeg -i <filename>.mkv -vcodec copy -acodec copy <filename>.mov

tygerbug
11th October 2012, 19:27
Thanks, used this command:
/Applications/ffmpeg -i /Tygerbug/Thief:Cobbler/ArabianKnightJapan-DVDE6.mkv -vcodec copy -acodec copy /Tygerbug/Thief:Cobbler/ArabianKnightJapan-DVDE6.mov

Resulted in an H.264 MOV that plays in Streamclip. Let's see if this converts.

Can FFMPEG convert video to Pro-Res 422 codec? Or PhotoJPEG codec?

smok3
11th October 2012, 19:33
Can FFMPEG convert video to Pro-Res 422 codec?
yes, (see ffdrop).

tygerbug
11th October 2012, 19:36
I don't understand this command-line stuff at all, so tell me exactly what I need to do? And type in?

smok3
11th October 2012, 19:41
ffmpeg -i avc.mp4 -pix_fmt yuv422p -vcodec prores -profile 3 -acodec pcm_s16le out.mov

# prores profiles: 0 = proxy, 1 = LT, 2 = "normal", 3 = HQ

tygerbug
11th October 2012, 20:12
Thanks so much, that seems to have done the trick. I've got a big 22GB file of Arabian Knight now in ProRes format with no glitches.

Emulgator
12th October 2012, 09:23
Very happy to hear that !

tygerbug
12th October 2012, 14:14
Emulgator has done terrific work on the footage, by the way.

tygerbug
12th October 2012, 19:24
I spoke too soon in declaring this issue resolved.

While Smok3's ffdrop process did successfully convert the material to Pro-Res without these glitch frames, it did so at a detriment to the quality of the video.

A close look at the converted footage shows what look like subtle vertical resizing artifacts, of the sort you get when you enlarge a video in an editing program and the program interprets it as interlaced footage even though it isn't.

I'm going to try Neuron3's repackaging-in-ffmpeg idea again.

tygerbug
12th October 2012, 19:39
Repackaged in FFmpeg as .MOV, at Neuron3's suggestion.

Nope, glitch frames very much present after converting to ProRes in MPEG Streamclip. Glitch frames don't show up when playing repackaged file but appear upon conversion.

Frame rate of the MKV files I'm trying to convert is 23.976, which might explain why ffdrop apparently interpreted the footage as interlaced. I can't change the frame rate to 24 in Cinema Tools either, since it's H.264.

smok3
12th October 2012, 22:08
While Smok3's ffdrop process did successfully convert the material to Pro-Res without these glitch frames, it did so at a detriment to the quality of the video.


what? did you use ffdrop or the ffmpeg commandline? what ffmpeg version? What is your player? What OS? explain. (video quality will of course slightly drop, its still lossy > lossy conversion)

ffdrop apparently interpreted the footage as interlaced
ffdrop is fully DIY/manual labor for a converting - person, it doesnt do anything automagically and it does not try to "help".

Asmodian
12th October 2012, 22:10
I do not think it assumed the video was interlaced, your command line explicitly states the format to be progressive (-pix_fmt yuv422p). Why would 23.976 be interlaced?

Maybe try just saving the decoded video to a raw uncompressed format? It sounds like this is a long term project with quite a bit of work put in, a few hundred gigs for an intermediate file should be fine. ;)

ffmpeg -i avc.mp4 -pix_fmt yuv422p -vcodec rawvideo -acodec pcm_s16le out.mov

tygerbug
12th October 2012, 22:12
I typed this into Terminal:
/Applications/ffmpeg -i /Tygerbug/Thief:Cobbler/ArabianKnightJapan-DVDE6.mkv -vf yadif=0 -pix_fmt yuv422p -vcodec prores -profile 2 -acodec pcm_s16le /Tygerbug/Thief:Cobbler/ArabianKnightJapan-DVDE6ProRes2.mov

As I said, the result looked a bit odd, having what looks like subtle vertical interlaced resizing artifacts.

Asmodian
12th October 2012, 22:19
-vf yadif=0 ??

Don't tell it to deinterlace. (http://ffmpeg.org/ffmpeg.html#yadif)

tygerbug
12th October 2012, 23:13
Hmm, running it to uncompressed results in a 70+ GB file which doesn't play correctly - just a bunch of random bright-colored noise with the footage sort of visible within it, repeated several times.

EDIT- Ah, Yadif might be the culprit, let me run that one ...

tygerbug
12th October 2012, 23:18
Yep! Ran it without Yadif and the footage looks as it should!

Thanks Asmodian and Smok3 .... Going to encode everything again; I think the problem is solved now.