Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VirtualDub, VDubMod & AviDemux

Reply
 
Thread Tools Search this Thread Display Modes
Old 2nd November 2009, 11:03   #1  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
Problems with avidemux and m2ts

I'm trying to encode videos from my Canon HG20 camcorder (1920x1080 AVCDHD in m2ts format), and encode it to MP4/M4V format with x264. I've been at it all day today, trying different versions, searching forums etc but I just can't get it to work

Specifically with avidemux I'm having these problems:

For some reason avidemux recognizes my m2ts 1920x1080 videos as 1920x1088 which creates a black 8px border at the bottom of the video I don't get why, since obviously videos are in standard 1080p and both Handbrake and various media players properly reports the files as 1920x1080.

More importantly though, after I encoded my video and try to play the 640x360 .mp4 (with 8px crop and resize) I get some really weird slowmotion video (but playing at full speed according to mediaplayer looking at the time progress!) and the audio drops out after pretty much exactly half of the video, so it seems like the video is encoded/playing at half speed but audio at full speed?!

If someone could please let me know what's going on and if there's a way to fix this I'd greatly appreciate it! I'm going mad here

edit: I've tried both avidemux v2.4.4 and the later v2.5.1 versions, and get the same problems using both

Last edited by Crabba; 2nd November 2009 at 11:05.
Crabba is offline   Reply With Quote
Old 2nd November 2009, 12:14   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Videos must be encoded at "mod16", because internal macroblocks of 16x16 pixels are used. So non-mod16 resolutions are padded to the next multiple of 16.

Therefore 1920x1080 ("1080p") is actually encoded at 1920x1088. The 8 pixels are padded at encoding-time and (usually) are cropped at playback-time.

I don't have a clue why Avidemux doesn't crop it in that case (the decoder probably should do that automatically), but you can simply use the "Crop" filter.

As an alternative, you could try to open your file in Avidemux through the Avisynth Proxy via DG(AVC)Decoder...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 3rd November 2009, 02:58   #3  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
Thanks for your reply, that sort of explains the seemingly weird 1088 resolution, but why does it do that to the source though? And in Handbrake I can choose to use 8x8 blocks instead, isn't that possible in avidemux? I would like to resize to a 1:1 AR resolution, both for storage and display, which would work perfectly with 1920x1080->640x360 using 8px blocks...

That's unfortunately not my main problem though, which is that the encoded output file is not playing at full speed, but seems to be encoded/played back at half speed. I'm thinking this may have something to do with the weird way that HD camcorders like the HG20 apparently stores so-called 30p video in the m2ts container as 60i (correct me if I'm wrong, but that's what I've been able to figure out from hours of reading up on it), but avidemux reports the original m2ts file as 29.970 fps.

Actually, I just checked this right now and realized that it must have something to do with this frame rate issue, because avidemux thinks that my m2ts file is 1:47 minutes long, but if I play the file with Nero showtime it's only about 52 seconds (playing properly at full speed)!

So it looks like this is some kind of bug with avidemux? Any chance this bug could be fixed in the next version, and is there anything I can do on my end to fix this so I can use avidemux with my m2ts files?

Are there any other virtualdub / avidemux or similar editors out there that can handle m2ts files, and encode to x264? I really want to get this working somehow, but I feel like I'm really running out of options here

Thanks!
Crabba is offline   Reply With Quote
Old 3rd November 2009, 13:29   #4  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
If Avidemux doesn't detect the frame-rate properly (which of course shouldn't happen), you can still overwrite the frame-rate with the proper value by hand.

Also if the video is "60i", which means "60 fields per second" aka "30 interlaced frames per second", you may want to apply a deinterlace filter when re-encoding...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 4th November 2009, 01:20   #5  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
I'm not really sure what I should do. Avidemux says the video has a frame rate of 29.970fps with the "custom frame rate" box checked by default, but obviously I don't want to reencode to an x264 60fps file, so what if anything can I change to fix that? Also, I've tried both with deinterlacing and without, but the resulting video still played half speed as before. The total amount of frames in the video is 3210, and like I said according to avidemux it is 1:47 long.

I believe I tried yadif and one more, can't remember which one now but again I'm not really sure what to select, there are several deinterlacers and about as many options on each So if the video is "30p" (or assumably 29.970fps) inside a 60i container (if what I read is correct about how it stores the video), then what deinterlacer and options should I choose?

Thanks!
Crabba is offline   Reply With Quote
Old 4th November 2009, 12:18   #6  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Quote:
Originally Posted by Crabba View Post
So if the video is "30p" (or assumably 29.970fps) inside a 60i container...
Such thing doesn't exist. It's either 30 progressive frames per second -or- it's 60 fields per second ("interlaced"). The latter could also be considered as 30 interlaced frames per second, as you usually won't see individual fields of interlaced content, but two consecutive fields weaved to an "interlaced" frame. For basic info on interlacing you should look here:

http://100fps.com/

Quote:
Originally Posted by Crabba View Post
what deinterlacer and options should I choose?
From the deinterlacers available in Avidemux I'd recommend YADIF.

It has two operation modes:
1. In "bob" mode the 60 fields/second content (60i) will be deinterlaced to 60 progressive frames/second (60p).
2. In the "normal" (non-bob) mode the 60 fields/second (60i) will be deinterlaced to 30 progressive frames per second (30p).

Obviously only method (1.) can preserve full temporal information ("smooth motion"), but produces twice the number of frames compared to method (2.). So at the same quality, with method (1.) the encoded file will be twice the size (very roughly), compared to the file encoded with method (2.). But method (1.) will certainly look more smooth, motion-wise. Now you decide...

BTW: It would be much easier to help you, if you did provide a sample file. So far we can only guess about the nature of your content.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 4th November 2009 at 12:23.
LoRd_MuldeR is offline   Reply With Quote
Old 5th November 2009, 12:32   #7  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
Quote:
Originally Posted by LoRd_MuldeR View Post
Such thing doesn't exist. It's either 30 progressive frames per second -or- it's 60 fields per second ("interlaced"). The latter could also be considered as 30 interlaced frames per second, as you usually won't see individual fields of interlaced content, but two consecutive fields weaved to an "interlaced" frame. For basic info on interlacing you should look here:

http://100fps.com/
Ok, I only know that the camcorder is supposed to be able to shoot in both 24p, 30p and 60i, but that apparently all files regardless of shooting mode is stored the same way in the m2ts container, don't ask me how that works

Quote:
Originally Posted by LoRd_MuldeR View Post
From the deinterlacers available in Avidemux I'd recommend YADIF.

It has two operation modes:
1. In "bob" mode the 60 fields/second content (60i) will be deinterlaced to 60 progressive frames/second (60p).
2. In the "normal" (non-bob) mode the 60 fields/second (60i) will be deinterlaced to 30 progressive frames per second (30p).

Obviously only method (1.) can preserve full temporal information ("smooth motion"), but produces twice the number of frames compared to method (2.). So at the same quality, with method (1.) the encoded file will be twice the size (very roughly), compared to the file encoded with method (2.). But method (1.) will certainly look more smooth, motion-wise. Now you decide...

BTW: It would be much easier to help you, if you did provide a sample file. So far we can only guess about the nature of your content.
Sure I'd love to help out if I can. I've uploaded a fairly small original video clip to filesend (13mb). I just signed up there, so let me know if you have any problems downloading the file, and also let me know if you need anything else that might help!
Crabba is offline   Reply With Quote
Old 5th November 2009, 23:04   #8  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
That video clearly is interlaced! And Avidemux does detect it as 29.97 frames per second, which equals 59,94 fields per second. Makes perfect sense to me



[EDIT]

Here is a re-encoded version of your source that was bobbed (using Yadif) to 60 progressive frames per second:
http://www.mediafire.com/file/mnrujz...0420120212.mp4

It was also downscaled to 1280x720 in order to keep the upload size small
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 5th November 2009 at 23:43.
LoRd_MuldeR is offline   Reply With Quote
Old 5th November 2009, 23:44   #9  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
Quote:
Originally Posted by LoRd_MuldeR View Post
That video clearly is interlaced! And Avidemux does detect it as 29.97 frames per second (which equals 59,94 fields per second). I can see no problem
Did you try to encode it to an x264 file? If so were you able to get a properly playing output?

I just tried it myself on this exact file with the latest release of avidemux (afaik) v2.5.1 (r5249), and again I get the exact same problem. The original video is approx 4 seconds long, but according to avidemux it is almost 9 seconds, and the encoded file plays the video at half speed and the audio at full speed, with audio dropping out after the first 4 seconds...

These are the exact settings I used:
Video: MPEG-4 AVC (x264)
filters:
1 - yadif mode 1,1
2 - resize 1920x1088 -> 640x368
x264 settings: 2-pass 2000kbps, umh search, prediction auto and left the rest at default settings
Audio: AAC (faac) 128kbps
Format: MP4
Crabba is offline   Reply With Quote
Old 5th November 2009, 23:47   #10  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
See my edit
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 6th November 2009, 00:20   #11  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
hehe, yeah you happened to edit your reply at the exact same time I was posting, except for the time zone difference of course

Ok, so I see you were able to encode it to a 60fps file that seems to be playing at correct speed @ about 4 seconds, so what did you do? Just change video custom frame rate manually to 59.94fps?

How can I get that working if I want to encode it to a 30fps progressive mp4? There doesn't seem to be an option like that?
Crabba is offline   Reply With Quote
Old 6th November 2009, 00:26   #12  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
Nope. The video framerate is detected correctly as 29.97 frames per second (interlaced), which means 59.94 fields per second.

After bobbing (e.g via Yadif) this results in 59.94 per frame. So there's no need to manually overwrite anything...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊
LoRd_MuldeR is offline   Reply With Quote
Old 6th November 2009, 01:21   #13  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
Ok, that's really weird, so the only thing you do is add the yadif and resize filter?

I've now tried using yadif both with "temporal & spatial check" (mode 0,1), bob, temporal & spatial check" (mode 1,1) and "bob, skip temporal & spatial check" (mode 3,1) but they all result in the same half speed 8 second video, with audio dropout after 4 seconds. What are you doing differently? I can see from the screenshot you posted that you also get "video total duration" 9.x seconds and "audio total duration" 4.5 seconds so I don't understand how you get the correct 4 second output without changing frame rate?

edit: I've added an example of an encoded x264 file to filesend to show how the output turns out for me, where the only thing I did was yadif bob only (mode 3,1) and resize to 640. It's a rar file complete with the two stat files.

edit 2: I figured it may have something to do with that I'm not using the latest build, so I installed the latest SVN build (from 10/27) and did some more testing, but alas that had no effect at all I also checked my manual for the HG20 camcorder about the whole progressive/interlaced deal, and it says like this about the PF30 mode (which is the mode I always use): "PF30: 30 frames per second, progressive. Use this frame rate to easily edit your recordings, for example, to post them on the web.". Then on the specs page, it has a little * note saying "Recordings made with the PF24, PF30 frame rate are converted and recorded on the hard disk/memory card as 60i". Very nice and vague

Last edited by Crabba; 6th November 2009 at 19:14.
Crabba is offline   Reply With Quote
Old 19th November 2009, 01:18   #14  |  Link
Crabba
Registered User
 
Join Date: May 2003
Posts: 31
Lord Mulder, could you please tell me exactly what you did to produce the video you uploaded earlier?

I have now tried several different things, but I have still not been able to reproduce a proper looking video like that!

I tried using both the latest SVN build (5422) as well as the one before (5369), and the release 2.5.1 build.
I tried using a different computer running vista
I even tried installing avidemux on my linux box (latest ubuntu release).
I tried pretty much every possible yadif deinterlacer setting, with and without a resize filter

Still I keep getting the same problems over and over again, a ~9 second video running half speed.

I also tried installing Mplayer, the one on your website next to avidemux etc, and it seems even the player has those same problems, as it couldn't even play the original m2ts file correctly (the one I uploaded here) and is also recognized as a 9 second video, with lots of stuttering in both video and audio, esoecially towards the end of video playback.

Please help me out here... I have no idea what to try next
Crabba is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:03.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.