AMVbe 1.2 Now in Beta

If you have questions about compression/encoding/converting look here.
User avatar
Bakadeshi
Abuses Spellcheck
Joined: Mon Sep 29, 2003 9:49 am
Location: Atlanta, GA
Contact:
Org Profile

Re: AMVbe 1.1.alpha5 - Batch Encoder for anime and amvs

Post by Bakadeshi » Mon Jan 11, 2010 8:52 am

Corran wrote: EDIT: I just tried CM3 for the hell of it... and it works. Odd considering dropping in your executables into my encoder did not work for me. I guess some x264 default settings have changed since mplayer/mencoder revision 29355... I suppose that is very likely considering how long it has been since then. CM3 with the slider set to extreme works as well.

I converted a 25 minute episode though and the audio desync'd quickly. I'll try some other files later.
ok thanks, that probably means its a new bframe option that android doesn't understand. Maybe b-pyramid, if that is enabled by default. I'll do some research and see if i can find out what the culprit is.

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: AMVbe 1.1.alpha5 - Batch Encoder for anime and amvs

Post by Corran » Mon Jan 11, 2010 5:21 pm

When you post the next build, could you enable harddup on the mencoder step also? I think the sync problems I'm encountering are a result of duplicate frames being lost in the encode. I encountered this problem around this time last year. When I test amvbe with the same files that gave me problems back then I get the same issue with the audio losing sync.

Mencoder Manual wrote:11.1.12.1. Improving muxing and A/V sync reliability

You may experience some serious A/V sync problems while trying to mux your video and some audio tracks, where no matter how you adjust the audio delay, you will never get proper sync. That may happen when you use some video filters that will drop or duplicate some frames, like the inverse telecine filters. It is strongly encouraged to append the harddup video filter at the end of the filter chain to avoid this kind of problem.

Without harddup, if MEncoder wants to duplicate a frame, it relies on the muxer to put a mark on the container so that the last frame will be displayed again to maintain sync while writing no actual frame. With harddup, MEncoder will instead just push the last frame displayed again into the filter chain. This means that the encoder receives the exact same frame twice, and compresses it. This will result in a slightly bigger file, but will not cause problems when demuxing or remuxing into other container formats.

You may also have no choice but to use harddup with container formats that are not too tightly linked with MEncoder such as the ones supported through libavformat, which may not support frame duplication at the container level.

I think this occurs because mencoder is not responsible for creating the container when performing multi-step encoding like this, mp4box is.

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: AMVbe 1.1.alpha5 - Batch Encoder for anime and amvs

Post by Corran » Mon Jan 11, 2010 6:45 pm

Also, it appears that you have the same problem with windows media video files that I did when adding streaming to this site. Mplayer is unable to determine the correct frame rate to render the video and inexplicably defaults to 1000fps. I think this is a result of wmv's capability to render at variable frame rates, however, most videos encoded with the wmv container still use standard, non-variable frame rates.

We solved this for the org by using mencoder essentially to direct stream copy the video to /dev/null and parsing the mencoder output to determine the total frame count of the video. We then use the video's duration to calculate an estimated frame rate.


Here is some of the code we used: (php)

Code: Select all

/*
The MIT License

Copyright (c) 2009 Anthony DeRobertis, Eric Parsons

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/ 

function getFps($filename){
  	global $mencoder, $mplayer;
  	
  	$fileparts = explode(".",strtolower($filename));
  	$ext = array_pop($fileparts);
  	
  	//If one of these file types, try to guess fps.
  	If($ext == "wmv" || $ext == "asx"){
	    $vidinfo = $mencoder . ' "' . $filename . '" -ovc copy -oac copy -o /dev/null 2>&1 | grep ^Video';
		unset($output);
		exec("$vidinfo 2>&1",$output,$return_val);
		if($return_val == 0){
			$vid_stream_data = strtolower(array_pop($output));
			$vid_stream_data = str_replace("  ", " ", $vid_stream_data); //Remove extra spaces
			$vid_stream_data_array = array_reverse(explode(" ",$vid_stream_data));
			$vid_frames = (int)$vid_stream_data_array[1];
			$time = (float)$vid_stream_data_array[3];
			
			if($time != 0){
				$rough_fps = $vid_frames / $time;
				//Estimate what fps should be. Use rough fps if nothing is close
				if($rough_fps >= 100){
				  	$fps = "100.00";
				}elseif($rough_fps < 63 && $rough_fps >= 56){		
					$fps = "59.940";
				}elseif($rough_fps < 53 && $rough_fps >= 47){
				  	$fps = "50.000";
				}elseif($rough_fps < 33 && $rough_fps >= 27){
				  	$fps = "29.970";
				}elseif($rough_fps < 27 && $rough_fps >= 24.5){
					$fps = "25.000";
				}elseif($rough_fps < 24.5 && $rough_fps >= 20.5){
				  	$fps = "23.976";
				}elseif($rough_fps < 18 && $rough_fps >= 13.5){
					$fps = "15.000";
				}elseif($rough_fps < 13.5 && $rough_fps >= 0){
					$fps = "12.000";
				}else{
				  	$fps = (string)$rough_fps;
				}
			}else{ //$time = 0, return false
			  	return false;
			}
		}else{ //mencoder command failed, return false
		  	return false;
		}
	}else{ //If anything else just look it up with mplayer identify
	  	$vidinfo = $mplayer . ' -identify "' . $filename . '" -ao null -vo null -frames 0 2>/dev/null | grep ^ID_VIDEO';
		unset($output);
		exec("$vidinfo 2>&1",$output);
	
		foreach($output as $value){
		  	$parts = explode("=",$value);
		  	$orig_vidinfo[$parts[0]] = $parts[1];
		}
		$fps = $orig_vidinfo['ID_VIDEO_FPS'];
	}
	return $fps;
}

Perhaps you could adapt this to work with amvbe? Essentially the function isolates the file extension and uses it determine the method of acquiring the frame rate. It then runs the appropriate mencoder or mplayer commands, parses the output, and in the case of wmv or asx files, estimates the most appropriate frame rate to return.

User avatar
Bakadeshi
Abuses Spellcheck
Joined: Mon Sep 29, 2003 9:49 am
Location: Atlanta, GA
Contact:
Org Profile

Re: AMVbe 1.1.alpha6 - (Need Ps3, Xbox360, and DROID testers)

Post by Bakadeshi » Mon Jan 25, 2010 1:16 pm

New version, Check first post for whats new.

Particularly need testers for Ps3 profile, since I don't have one yet. Also if xbox360 owners can test if the ps3 profile settings play on an xbox360.


DRIOD and Google NEXUS owners:
I believe some of the newer android hardware can support the more advanced h264 profile settings, I would like to test psp profile encodes on these 2 devices particularly to see if they will handle bframes and the other advanced settings that the psp profile uses, that the basic iphone/android profile does not support. I can then use this information to make a higher quality profile for the DROID and nexus one.

Thanks!
corran wrote: Also, it appears that you have the same problem with windows media video files that I did when adding streaming to this site. Mplayer is unable to determine the correct frame rate to render the video and inexplicably defaults to 1000fps. I think this is a result of wmv's capability to render at variable frame rates, however, most videos encoded with the wmv container still use standard, non-variable frame rates.
If this version does not solve the issue, can you provide a sample of the file having the problem so I can do some testing on my end? thanks!

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: AMVbe 1.1.alpha6 - (Need Ps3, Xbox360, and DROID testers)

Post by Corran » Mon Jan 25, 2010 6:53 pm

When I ran the new version for the first time I got the following error:
Error readind saved settings, Reverting back to defaults.
Your usage of harddup isn't working for me. I notice that harddup is present in the command line twice.
mencoder.exe "F:\Video\AMVs\02. Good AMVs\Grave of the Fireflies-MJ-FinalMemory.mpeg" -vf scale=480:-2,harddup -of rawvideo -nosound -vf-add harddup -subfont-autoscale 1 -subfont-text-scale 7 -slang en -ovc x264 -x264encopts threads=auto:bitrate=362:bframes=0:ref=5:subme=6:trellis=1:analyse=p8x8,b8x8,i4x4,p4x4:no-ssim:level=3:no-fast-pskip:no-
I'm guessing that isn't the complete command line but that is all that is displaying. Here is a file that you can test the harddup switch with: http://www.animemusicvideos.org/members ... hp?v=12511
Bakadeshi wrote:If this version does not solve the issue, can you provide a sample of the file having the problem so I can do some testing on my end? thanks!
The problem is still present. You can use this video for testing the wmv framerate problems.
http://www.animemusicvideos.org/members ... hp?v=30179

User avatar
Bakadeshi
Abuses Spellcheck
Joined: Mon Sep 29, 2003 9:49 am
Location: Atlanta, GA
Contact:
Org Profile

Re: AMVbe 1.1.alpha6 - (Need Ps3, Xbox360, and DROID testers)

Post by Bakadeshi » Tue Jan 26, 2010 12:27 pm

Corran wrote: I notice that harddup is present in the command line twice.
thanks I'll fix that. (though its actually harmless, all it'll do is set the flag to use it twice, overwriting the position at which to use it with the second occurrence. It only actually gets used once. )
Corran wrote:
mencoder.exe "F:\Video\AMVs\02. Good AMVs\Grave of the Fireflies-MJ-FinalMemory.mpeg" -vf scale=480:-2,harddup -of rawvideo -nosound -vf-add harddup -subfont-autoscale 1 -subfont-text-scale 7 -slang en -ovc x264 -x264encopts threads=auto:bitrate=362:bframes=0:ref=5:subme=6:trellis=1:analyse=p8x8,b8x8,i4x4,p4x4:no-ssim:level=3:no-fast-pskip:no-
I'm guessing that isn't the complete command line but that is all that is displaying. Here is a file that you can test the harddup switch with: http://www.animemusicvideos.org/members ... hp?v=12511
This probably isn't a harddup issue, since it happens when using the builtin muxer, and mplayer itself doesn;t play the file right. the problem is It's starting the audio as soon as the vid starts instead of after the opening title. Not sure why, maybe theres some kinda mpeg flag that tells it to delay the audio that mplayer isn't reading or something, but I'll try and find out if theres a way around it. in the meantime I can add an option in the audio panel to delay the audio manually.... which is probably a good option to have available in there anyway.

I still need to test the .wmv framerate problem, so If i find out anything with that, I'll post my findings later ;p

User avatar
Corran
Joined: Mon Oct 14, 2002 7:40 pm
Contact:
Org Profile

Re: AMVbe 1.1.alpha6 - (Need Ps3, Xbox360, and DROID testers)

Post by Corran » Tue Jan 26, 2010 10:45 pm

If it helps, here is how I extract the audio in my encoder while maintaining sync with mexicanjunior's video:

Code: Select all

mplayer.exe -af resample=44100,channels=2 -ao pcm:fast:waveheader:file="temp_file.wav" -afm libmad  -vo null -vc dummy "input_file.avi"

User avatar
Bakadeshi
Abuses Spellcheck
Joined: Mon Sep 29, 2003 9:49 am
Location: Atlanta, GA
Contact:
Org Profile

Re: AMVbe 1.1.alpha6 - (Need Ps3, Xbox360, and DROID testers)

Post by Bakadeshi » Fri Jan 29, 2010 12:01 pm

Corran wrote:If it helps, here is how I extract the audio in my encoder while maintaining sync with mexicanjunior's video:

Code: Select all

mplayer.exe -af resample=44100,channels=2 -ao pcm:fast:waveheader:file="temp_file.wav" -afm libmad  -vo null -vc dummy "input_file.avi"
"-afm libmad" does the trick. thanks!

Edit: Also, he wmv problem doesn't occur with the PSP encodes, it seems -ofps command was somehow removed from the Iphone profile. This fixes the framerate issue on dwp's vid. I will release a fixed version in a few days. No internet at home again, so a little hard for me to get online atm.

User avatar
Bakadeshi
Abuses Spellcheck
Joined: Mon Sep 29, 2003 9:49 am
Location: Atlanta, GA
Contact:
Org Profile

Re: AMVbe 1.2 Now in Beta

Post by Bakadeshi » Wed Apr 21, 2010 11:35 pm

yea i'm still working on this ;p (though admittedly slower than I started) this heres the nearing complete stage where I need all the feedback i can get to call this guy official. I think i've completed all the features now, (though i'm likely to have missed something knowing my track record) I've been working on this one for quite a while now, and figure ita about time I let it out. Let me know how ya like the new version, and any suggestions you might have. ^^

User avatar
Bauzi
Joined: Fri May 21, 2004 12:48 pm
Status: Under High Voltage
Location: Austria (uhm the other country without kangaroos^^)
Contact:
Org Profile

Re: AMVbe 1.2 Now in Beta

Post by Bauzi » Fri Jul 02, 2010 9:13 am

I need to convert the videos of a whole amv contest into one format. I will give this a shot :jester:
You can find me on YT under "Bauzi514". Subscribe to never miss my AMV releases. :amv:

Post Reply

Return to “Conversion / Encoding Help”