This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How to health check / repair MTS files?

Tags: None
(comma "," separated)
hlan
Registered Member
Posts
13
Karma
0
This is not really a Kdenlive issue but perhaps somebody here can help me ... finally I managed to upload my ~450 video clips (AVCHD MTS) into Kdenlive (proxies enabled). Rendering crashes eventually. After some time I found out that it happens always at the same clip. I then remove that clip from the timeline, restart rendering again until at some time later it crashes at yet another clip ...

The clips play well in VLC, but upset Kdenlive when rendering. Rendering in Kdenlive may just stall, or give an error message, e.g.
Rendering of /home/hlan/Desktop/STREAM/debug.mpg crashed
[h264 @ 0x798062e0] reference picture missing during reorder [h264 @ 0x798062e0] Missing reference picture
[mpeg @ 0x7a80adc0] VBV buffer size not set, muxing may fail
[mpeg @ 0x7a80adc0] buffer underflow i=0 bufi=234341 size=622092 [mpeg @ 0x7a80adc0] packet too large, ignoring buffer limits to mux it

Because all the clips come from the same camcorder, were recorded at the same day, clips before and after the offendee work I wonder if the camcorder output may be bad at times? Therefore, is there a way to health check and/or repair MTS files?

Attached output from Mediainfo for an offending clip:
General
ID : 1 (0x1)
Complete name : /home/somewhere/Desktop/STREAM/00143.MTS
Format : BDAV
Format/Info : Blu-ray Video
File size : 63.9 MiB
Duration : 31s 148ms
Overall bit rate mode : Variable
Overall bit rate : 17.2 Mbps
Maximum Overall bit rate : 18.0 Mbps

Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=3, N=12
Codec ID : 27
Duration : 31s 120ms
Bit rate mode : Variable
Bit rate : 16.3 Mbps
Maximum bit rate : 16.8 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.314
Stream size : 60.4 MiB (94%)

Audio
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Codec ID : 129
Duration : 31s 232ms
Bit rate mode : Constant
Bit rate : 256 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : -80ms
Stream size : 976 KiB (1%)

Text
ID : 4608 (0x1200)
Menu ID : 1 (0x1)
Format : PGS
Codec ID : 144
Duration : 30s 656ms
Delay relative to video : -80ms

yellow_drupal
Registered Member
Posts
748
Karma
0
hi again

I think it's not so much the 'health' of the files created by your camera at a certain time, unless you've changed your camera settings ie: a progressive recording vs interlaced, but more the media framework's ability in kdenlive/ MLT to deal with the decompressing, seeking and handling of the h264 in the MTS container, including an ongoing problem for a number of years with ffmpeg decompressing interlaced h264. Which your sample appears to be or at least flagged as such.

Additional frames have been known to be added in decompressing, messing up the process of playback, editing and reencoding.

VLC plays them fine, but playback can be a little less demanding than procesing and reencoding.

Have you tried remuxing? I know we've discussed this on other threads? MKVMergeGUI perhaps to matroska? Try support for h264 in other containers via remuxing in ffmpeg.

Also it seems your camera, Panasonic SD90 camcorder?, can capture progressive h264, for the European PAL site:

"HDC-SD90, records in full-HD 1920 x 1080, 50 progressive recording at a 28-Mbps bit rate, which allows the camcorders to conveys about twice the information of 1080i (interlace) recording to produce the ultimate in image quality."

"RECORDING SECTION
Signal System 1080 / 50p, 1080 / 50i
Recording Format 1080 / 50p : MPEG-4 AVC/H.264 (original format) / HA / HG / HX / HE : MPEG-4 AVC/H.264 (AVCHD standard compliant)"

Is it set to 50P, although your mediainfo output says 'interlaced' and 25p so that would be 50i, maybe it's flagged as interlaced but contains progressive frames? Many consumer cameras do this, including Canon HV range with mpeg2. Can you clarify your camera menu settings, progressive or interlaced?

Confusingly the manual says this:

"Motion Picture Compatibility

Video Signals for the AVCHD that can be played back with this unit are 1920x1080/50i, 1920x1080/25p and 1440x1080/50i."

No mention of 50p.

Hope others can offer suggestions.
normcross
Registered Member
Posts
300
Karma
0
I have Panny SD600 which has exactly the same recording capabilities. I do all my work using HA 50i 17 Mbps (VBR) and I do not have any real problems at all using MTS clips. Over the past year and a half, I have only had two faulty clips from the camera. They didn't crash Kdenlive but just played strangely. (fast motion then freeze until the clip finished)

Have you tested your clip by just opening Kdenlive, adding the offending clip on it's own and rendering it? (not sure if that's what you meant by " but upset Kdenlive when rendering.")

Is this a memory issue? I'm usually up to about 4Gb when working on a 3/4 minute Project, then rendering it without first closing down Kdenlive and re-starting just for the render.
hlan
Registered Member
Posts
13
Karma
0
The camcorder is a Panasonic SD90, settings AVCHD [HA=17Mbps] 1920x1080 /50i. These settings were not changed between the clips. The Kdenlive project settings are HD 1080i 25fps

PS I did not record in 50p because at the time I felt it was too "proprietary" when reading in the manual that it can get played only on the camcorder - but anyway, my recordings now are the other format so it would be great to get it working...

Because kdenlive bumps out only at every ~50th clip, i.e. happily processes ~49, I do wonder why it works for so many clips and not for some others?

I tried remuxing (handrake) but the result was not that great - what settings do you advise?

Kind regards
yellow_drupal
Registered Member
Posts
748
Karma
0
Strange that kdenlive stops after 50 clips. In your render panel for the format you're encoding to, how many encoder threads are you using? Have you tried encoding a project with one thread?

For remuxing, mkvmergeGUI is a open source app that you basically drag your MTS files into it and repackage the h264 and audio streams into a matroska container.

You could try it but sounds like it's a hardware / memory problem at render time. But the PPA is available from here anyway:

http://www.bunkus.org/videotools/mkvtoolnix/downloads.html
hlan
Registered Member
Posts
13
Karma
0
It is not a PC issue, the rendering (for mpeg) uses ~2GB of RAM, there is sufficient HDD space for temporary and final video files. Threads were left at the default 1 for not taking unnecessary risk.

For Yellow's hint all clips were moved to matroska mkv viedo format. Then Kdenlive renders (threads set at 4) to the end, taking some hours :-). Yellow, great tip - thank you so much!

I assume then that the Panasonic SD90 in some situations writes or omits video information that then may confuses rendering programs, and that the mkv container gives back all that required meta data? I do not think there is a bug in Kdenlive (maybe it could be made more robust by using properties of the previous clip if some information was missing? In future I will try recoding in the 50p option but then, the mkv remuxing was super fast and not an issue if it had to be kept...

Additional question to Yellow - what format & tools to you use to create the DVD?

Again, thank you very much ! and kind regards.
yellow_drupal
Registered Member
Posts
748
Karma
0
So pleased your sorted out now, yes remuxing is quick and can help where support for certain codecs and container combinations may be more patchy.

re DVD, I don't actually make any, all h264, web based and streaming to players.

But kdenlives own DVD Wizard in the up coming release / git builds looks great so I think that a good starting point.
User avatar
ttguy
Moderator
Posts
1152
Karma
6
OS
http://userbase.kde.org/Kdenlive/Manual/File_Menu/DVD_Wizard


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]