VidsOpt v0.2.4 - Fast MP4 Muxer/Converter

GetLaid

Senior Member
May 10, 2011
102
10
0
So I tried to implement the command changes you mentioned but still cannot successfully complete the muxing phase. I guess this is a bit over my head :confused:
 

Arkymedes

Senior Member
Dec 6, 2009
414
23
0
France
Hello

First of all thanks so much for this script, it's really saving me here and I'm using to re-encode some videos to watch on my Transformer.

One question though... is it advised to use this script for, let's say, re-encode a BluRay movie for TV? I have a good set at home with a 47" 1080p TV and would like to know if this script takes in consideration setups of this type.

Thanks!
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
A HDTV is just a bigger screen, so use 1080p res. Note that the script doesn't upscale the resolution, since there's no gain in fidelity. A 720p source will stay 720p.

The script was written for "processed" content, eg downloadable stuff. It doesn't process raw BluRay content (typically in MT2S container) which requires further processing.

For Tegra 2, 1080p requires baseline profile, which has same quality at 15% larger size. An alternative is to use the more efficient high profile, and get a more powerful tablet.

FYI: The folder link in the OP has been updated with new clips to better test the 2nd-gen SoCs. My gauge is that OMAP 4430 can handle the 1080p_avg clip, and the Tegra 3 can probably do 1080p_master. Tegra 2's limit is 720p_avg and 1080p_min.
 
  • Like
Reactions: Arkymedes

Arkymedes

Senior Member
Dec 6, 2009
414
23
0
France
Thanks for your answer. One more question:

I noticed that the audio gets converted pretty heavily but I have many videos with high bitrate 6 channel audio and don't want to convert them to 128kbps stereo.

Is there a way to keep the audio the same? Or at least not down convert so much?

Thanks again!
 

sprinkle32

New member
Feb 13, 2011
2
0
0
a quick question though, recently tried converting a couple of mini 720p mkv videos and it keeps displaying the error: bad timestamp occurred and the file size would be like only 2-3 kb... any help pls?
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
>I have many videos with high bitrate 6 channel audio and don't want to convert them to 128kbps stereo.

Search this thread on how to modify output audio quality.

The script is intended for mobiles, and also to conform to Android's subset of the MP4 spec. For the latter it means stereo AAC. For the former, it means not to exceed the fidelity of the mobile's playback equipment (most likely headphones). The present setting was selected with these in mind.

To keep original audio, run ~\mkvtoolnix\mmg.exe. Drop both source and newly-made MP4 into it. Select the new (slimmed down) video and original audio, then click Start Muxing. You'll get an MKV, which can be played in hardware mode with something like Dice Player. There may be other players that can do the same.

@sprinkle32

The majority of problems are due to bad muxing. Drop video into ~\mkvtoolnix\mmg.exe and remux, then retry conversion.

If that fails, drop problem video onto MakeSample.cmd script to make a sample. Upload it somewhere, then PM me with link. If the source is small enough, then upload the whole thing.
 
Last edited:

EndlessRuin

Member
Nov 28, 2011
6
0
0
Las Vegas
Nook Tablet Conversions

I have a rooted Nook Tablet and I have been using your application to convert videos. So far it works really well and it is easy to use. I have a couple of questions, first I believe the Nook Tablets processor is faster than Tegra 2. It has the following specs:

CPU brand: TI
CPU family: OMAP 4
Clock speed: 1 GHz
Cores: 2

What would you suggest the quality setting for videos be? The source being HD MKV movies and tv shows.

Another questions is a lot of the content I have is dvd rips in xvid. I understand the old adage of crap in = crap out but, I am wondering if converting from avi to mp4 would provide a large increase in battery life vs software decoding with moboplayer. It takes about 5 minutes per 2 hour movie to convert. If I were going to see considerable improvement in battery life it seems well worth converting them all.

Thanks for developing this awesome application.
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
Yeah, OMAP 4430 is more powerful for multimedia. Go to the link in the OP and try the test clips. All clips were upgraded with 4430 in mind. More info here.

http://forum.xda-developers.com/showthread.php?t=1348488

Nook Tab should play up to 1080p_avg (may be _max). Tegra 2 may be able to play 720p_avg. Tegra 3 should play 1080p_max and probably _master as well.

>quality setting for videos

Pretty much whatever you want. The NT is 1024x600, so if encoding just for the NT, then 1024 width, CRF 21, high profile would give optimal quality. If you have (or plan to have) other tablets, then 1280 width would be a good standardized resolution.

Personally I encode to 800 width for mobiles, since it's the native res for phones, and image quality looks fine to me. IMO the 1:1 screen-to-image pixel ratio is overrated. It's hard for your eyes to discern all the details on a 7" or 10", as opposed to a 50". Admittedly, it's a personal preference.

Try different resolutions and see what fits you. Stick to CRF 21, though.

>if converting from avi to mp4 would provide a large increase in battery life vs software decoding

I don't know, since I converted all my stuff. You'll have to test and see. I'm not sure with Mobo, but MX player allows the option of looping a video, so you can test loop the vids and do separate battery run-down tests.

>It takes about 5 minutes per 2 hour movie to convert.

You're probably using the Very Fast option. Be aware that while it's much faster (and slightly smaller size) than the Medium speed option, image quality is slightly worse. You have to do a frame-by-frame compare to see the difference, but it is there. For an OCD type, it may be worthwhile to use Medium and have it take up 15 mins per conversion. Again, personal pref.
 
Last edited:
  • Like
Reactions: EndlessRuin

EndlessRuin

Member
Nov 28, 2011
6
0
0
Las Vegas
e.mote thanks for the reply and answering my questions. I would also like to use the encodes on my Roku and Roku 2 through the Plex app. I think I will go with 1280 as the files look amazing on both devices and the file size is just under 2GB which is manageable for my tablet. Most of what I am downloading is 720p, both of my HDTVs are 720p and my older Roku only supports 720p so I think that is my sweet spot. I will probably do another round of mobile only encodes as you suggested when I get back from my vacation. I am also gonna try the medium speed setting and see how that works out. Thanks, Endless Ruin.
 

thes3raph1m

Member
Jan 16, 2008
16
1
0
e.mote thanks for this, i was on the verge of returning my transformer when i found this thread

now ive got it all set up i only have 2 questions

1.) what is the difference in quality between say 23 and 25, what i mean by that is what is it changing and could you quantify it, ill have a play later with some music videos that are handy for testing (and fun to look at as its katy perry)

and 2.) is there a way to make the script auto start, for example, i can remotely set downloads and can remotely set the transcoding script (though i need to vid recode nearly all the things i download) i have set the script how i want and used option c to save config, but i still need to enter "s" to start, is there a way to skip this step, then i could set a batch file to autorun every x hours on a preset folder, convert all the videos then clear the folder of the source files (im assuming i can set a seperate folder for the finished files from the script) this way i can set things to download and then run the script every 6 hours or 12 hours or whatever

oh... a third question

3.) if i have one instance in the process of encoding and the autoscript tries to run a second instance how would that effect the process... never mind, i just realised i can set up a file creation and verification step in whatever batch file i write, ie, check if lock file exists, if yes exit, if no create file and continue to process

---------------------------------
UPDATE
---------------------------------

Hello, ok so after some playing ive created a fully automated version of your script,

i added after the echo of processing complete a directory wipe for the source directory and an exit command so it doesnt go to end anymore so no error reporting but if the files work fine then its not important, if they dont work then use the manual one to work out why

it works off the preset you will create using the original version of the script

i also created a bat file to run your script only after checking for the presence of a lock.txt file in the source directory, if it is found, the process stops there, if not one is created before the automated script is called, this lock file is wiped along with the source files upon completion of the script.

i made it automated by removing from the "cls" before it echos out the menu and down to the end of that statement (including all key test options) and replacing it with the code for the "s" option so the program acts as if it had recieved the "s" result of the key test. again this sloppy coding removes your error checking but for my purposes is fine. also the exit command i previously mentioned after the directory wipe completes the automation cycle.

ive attached the edited batch files so you can peruse at your lesiure, or if anyone else wants a sloppily coded but automated script your welcome to use it but beware, its quite hobbled in terms of error checking and recovery.

use the regular script first to create the preferences and search for (without quotes) "d:\encode" and change to your source directory (THIS DIRECTORY WILL BE WIPED AFTER THE RUN!) search for "c:\users\dave\desktop\vidsopt\" and change to your folder with the script in also place the automated script in that directory

change the values in both scripts here.
http://www.filesonic.com/file/T7CwQDM/automated2mp4.cmd
http://www.filesonic.com/file/VqrthKY/encode.bat
thanks in advance

your loyal servant

dave

p.s) merry christmas, felis navidad, joyous kwanza, a lichtigin Chanukah, and a happy new year
 
Last edited:

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
>what is the difference in quality between say 23 and 25

Basically whatever you can see with your eyeball.

CRF determines bitrate. With a higher CRF, bitrate is lowered, and image will be "softer." You will not get any artifacting or overly blurred areas (grass or shrubs) unless you use a ridiculously high CRF like 30+.

CRF 19 is considered transparent (ergo, archival) quality, ie you shouldn't be able to tell difference from source. CRF 23 is the default setting for x264. CRF 21 is what I consider the happy middle ground. You can go higher or lower depending on your eyeball. Also, note that this is a float, so you can use, say, 22.5983.

>is there a way to make the script auto start

Search for :.StdSettings

Beneath it, insert these 2 lines
set "_key=s"
goto .AutoStart


Search for if /i '%_key%'=='s'

Above it, insert this line
:.AutoStart

I just saw that you've done it yourself. The beauty of a script is that it's just a text file, and readily modifiable by the user.

>tries to run a second instance

Multiple instances are possible. All working files are stamped with their own random number, and the source file is not locked.
 

thes3raph1m

Member
Jan 16, 2008
16
1
0
hey, wow thats a much neater version of the mess i made lol

the reason i wanted single instancing to work, is if i set it to run once every x hours and then after encoding erase source, which i do as i know what i put in the folder works, just needs processing, then if i put x+1 hours of work in the folder the script will start again before the first one has finished, thus re-doing the work that is already done, slowing everything down too, then once the first script erases, the second script will crash and all hell breaks loose,

on a remote system, stability is key, if it crashed i cant fix it.

the use of the following secondary script
Code:
IF EXIST lock.txt (EXIT) ELSE (echo "text" > lock.txt)
2mp4.cmd
makes it create a lock file that the script will look for when starting the encode so as to prevent above scenario
 
B

bd85

Guest
@bd85
>Can your script be used to only convert audio on mkv files and leave the video untouched?

Yes. Set video convert to "no."

>remove audio tracks you dont need and convert the dts. 5.1 one u want to use to stereo.

The script converts only the first audio track (to 2.0 AAC) and ignores any following. If audio is already AAC, it is passed through as-is.

To get a different audio track instead of the 1st, use MKVToolnix (included in the package) to remux with just the desired track.
Thats from the Asus Prime forum. Thought to move it here instead so I do not goes offtopic the other thread.

Works perfectly and is a fast and easy way to reduce file size,.
And may become easier for Prime to play the movie when it's AAC audio instead of DTS?

Can you raise the audio bitrate or will i not notice any difference?
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
The edits are made on the script file, 2MP4.CMD. The speed preset only pertains to video encoding; audio encode takes only a few minutes for a 2-hr video in any case.
 

godaro

Member
Jul 28, 2009
16
3
0
first of all I would like to congratulate the author for the great job he did with this script. although I am a noob, I had satisfying results with the re-encodes using this script from the first attempt

However, I would like to point out some aspects: I noticed high profile 720p playing well on my Iconia as long as ReFrames <5. HD material encoded high profile with ReFrames of 2 or 3 plays very well. Maybe this aspect makes sense for you because for me it's just empirical evidence, as I am lost in such details.

If my point about too many ReFrames does make sense to you, I wonder if you can enable an option in your script to downscale ONLY the Reframes (i.e to a safe value of 3) and leave other parameters intact: profile level, bitrate, etc.
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
ReFrames is part of the preset chosen. VeryFast: ref=1, Medium: ref=3, VerySlow: ref=16. For "toons" tuning, reframes are doubled (to max of 16). As the readme.txt indicates, veryslow preset is not recommended for mobiles.

You can set the --ref parameter explicitly, which then overrides the preset. It's not advisable, however.

>if you can enable an option in your script to downscale ONLY the Reframes

x264 uses its own defaults (the medium preset) if you don't specify anything. It's neither possible to preserve original bitrate, since the script uses one-pass CRF, and not 2-pass bitrate.
 

rcrh

Senior Member
Jun 21, 2011
87
5
0
I know it's been a long time since anyone looked at this thread but I'm wishing upon a star here...

Is there a way to use this script to simply re mux an MKV to MP4? I've actually got a Roku box and use Plex to play back local media. Plex really really really prefers mp4 containers instead of mkv. I've tried a few other utilities to remux but I've not found one that ALWAYS keeps the audio in sync. This script hasn't failed yet. But I do loose multi track (AC3) audio.

Any help here would be HUGE!!!

Thanks in advance.