VidsOpt v0.2.4 - Fast MP4 Muxer/Converter

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
0.2.1
. Fix 'fake' framerate value in some fansub animes.

Many animes (example: all [Horriblesubs] animes) have their framerate changed in the container to an invalid value. For simple remux, this value is ignored. But if video is recoded, the 'fake' value is used, leading to a bad framerate in the new copy. Fixed.

Ironic that warez would incorporate "copy protection" schemes.
 
  • Like
Reactions: marctronixx

Kippui

Senior Member
Jan 1, 2011
595
37
0
0.2.1
. Fix 'fake' framerate value in some fansub animes.

Many animes (example: all [Horriblesubs] animes) have their framerate changed in the container to an invalid value. For simple remux, this value is ignored. But if video is recoded, the 'fake' value is used, leading to a bad framerate in the new copy. Fixed.

Ironic that warez would incorporate "copy protection" schemes.
:) Such a great script

Do you think you can add the option hardcode subs? I misplaced my headphones to my xoom so I'm back to using my PS3 atm. My media server takes forever because G is so slow + idk how to stop the large file sizes
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
0.2.2
. Add subtitle burn-in option.

Script Options
. Burn-in subtitle (Advanced Option)
If enabled, the script will take the first eligible subtitle and burn it into the video. Subs can be of SRT, ASS, SSA, or VobSub (bitmap) format. Video recoding is mandatory.

Limitations
. Hardsubbed video can't be VFR (for now).
. Sub burn-in can't make use of any embedded font, a system font is substituted. Workaround: Drop in video to have the fonts extracted. Install the fonts onto your system. Then drop the video again for hardsubbing. Afterward, uninstall font from system if no longer desired.
 

jeffw111

Senior Member
Aug 27, 2010
119
24
0
Not sure what's wrong

e.mote,

Not sure what I'm doing wrong the script seems to be functioning i.e. no errors or crashes however the resulting MP4 files is empty. Below is the dump of the specs for the file.:confused:

General
Unique ID : 245179630546610563684893955238988154346 (0xB873E114B74E577333227AA17C0D05EA)
Complete name : C:\Users\Jeff\Videos\HOODWI~1\Hoodwinked.mkv
Format : Matroska
File size : 16.3 GiB
Duration : 1h 21mn
Overall bit rate : 28.8 Mbps
Encoded date : UTC 2011-07-19 16:59:41
Writing application : MakeMKV v1.6.12 win(x64-release)
Writing library : libmakemkv v1.6.12 (1.2.0/1.1.0) win(x64-release)

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1h 21mn
Bit rate mode : Variable
Bit rate : 25.2 Mbps
Maximum bit rate : 35.0 Mbps
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate : 29.970 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : MBAFF
Bits/(Pixel*Frame) : 0.405
Stream size : 14.3 GiB (87%)
Language : English
Color primaries : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics : BT.709-5, BT.1361
Matrix coefficients : BT.709-5, BT.1361, IEC 61966-2-4 709, SMPTE RP177

Audio #1
ID : 2
Format : DTS
Format/Info : Digital Theater Systems
Format profile : MA / Core
Codec ID : A_DTS
Duration : 1h 21mn
Bit rate mode : Variable
Bit rate : 1 561 Kbps / 1 510 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Compression mode : Lossless / Lossy
Title : Lossless
Language : English

Audio #2
ID : 3
Format : DTS
Format/Info : Digital Theater Systems
Codec ID : A_DTS
Duration : 1h 21mn
Bit rate mode : Constant
Bit rate : 1 510 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Compression mode : Lossy
Stream size : 876 MiB (5%)
Title : 3/2+1
Language : English

Menu
00:00:00.000 : en:Chapter 00
00:00:16.549 : en:Chapter 01
00:02:41.561 : en:Chapter 02
00:05:46.713 : en:Chapter 03
00:10:50.916 : en:Chapter 04
00:14:14.620 : en:Chapter 05
00:18:07.586 : en:Chapter 06
00:22:18.003 : en:Chapter 07
00:25:24.556 : en:Chapter 08
00:28:00.812 : en:Chapter 09
00:31:00.525 : en:Chapter 10
00:34:48.920 : en:Chapter 11
00:39:05.242 : en:Chapter 12
00:41:58.749 : en:Chapter 13
00:46:39.329 : en:Chapter 14
00:50:54.584 : en:Chapter 15
00:53:48.925 : en:Chapter 16
00:57:01.317 : en:Chapter 17
01:00:19.616 : en:Chapter 18
01:04:50.553 : en:Chapter 19
01:10:02.031 : en:Chapter 20
01:14:25.327 : en:Chapter 21
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
1. Check for enough free space on C: drive, presumably where your temp folder is at. The script takes care to minimize its working footprint, but it's always possible to run out of space.

2. Read and do FAQ Q #3.

3. Use script below to make a 1-minute sample of your movie (place it inside the VidsOpt folder). Check to see if sample still has empty-output issue. If yes, upload sample and I'll take a look at it.

NB: Above MKV is badly made. Most Bluray rips are progressive, yours is interlaced (encoding MBAFF). You can also tell by the 29.97fps framerate. Most Blurays are either 23.976 or 24. Hookwinked in particular is 23.976. The VidsOpt script is meant for progressive content, and does not work with interlaced content (it doesn't use an deinterlace filter). You'll get an output, but it would probably look like crap.

Suggest adjusting the settings on MakeMKV accordingly, or if not possible, then get a better Bluray ripper.
 

Attachments

Last edited:

jeffw111

Senior Member
Aug 27, 2010
119
24
0
Ah interesting that you should say that it was not actually the MKV encoder in this case it was the source Bluray Hoodwinked. For some reason the studio that released did the transfer in 1080i instead of 1080p (go figure). Now it makes sense why it wouldn't encode anyting. I'll re-test on a known 1080p Bluray and let you know my results. Any suggestions on de-interlacing this one?
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
My mistake. Hoodwinked is indeed in 1080i,

http://www.blu-ray.com/movies/Hoodwinked-Blu-ray/17791/

>Any suggestions on de-interlacing this one?

It depends on the tools you use. Most converters have a deinterlace filter. Since Hoodwinked can be inverse-telecined (IVTC) back to 23.976 (see clip below), then it's better to use a IVTC filter.

Handbrake has auto-IVTC (--detelecine). If you're using the GUI, enable the detelecine filter. If you prefer commandline, get the HB CLI version,

http://build.handbrake.fr/view/Nightlies/job/Windows

and use the commandline below to convert your MKV to MP4 (case is sensitive),
Code:
handbrake -i infile.mkv -o outfile.mp4 -m --detelecine -X 1280 -q 21 -e x264 -a 1 -E faac
this specifies high profile. For main profile, append,
Code:
-x no-8x8dct:cqm=flat
For baseline profile, append,
Code:
-x no-8x8dct:bframes=0:no-cabac:cqm=flat:weightp=0
 

Attachments

danbroken

Member
Jan 7, 2010
29
1
0
Brasília
Very Good!!! Great application!!!

Great application!!! It's all that I need. Now I can convert my 720p movies mkv to mp4 in minutes with little steps. So easy. Congratulations and Thanks. :)
 

GetLaid

Senior Member
May 10, 2011
102
10
0
I'm having playback issues with files remuxed using the 0.2.3 FFMPEG script (on my Asus Transformer with stock player). The file will play for about 5 to 10 minutes but then the picture will suddenly return to the beginning while the audio keeps going. Also, I cannot seek past 10 minutes. Strangely, playback of files created with the 0.1.5 script using MP4box are working fine. FYI, these are 720p high profile 90 min to 2 hr movies.
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
No idea. Provide specs & sample. Use below script to make sample clip (place it in same folder w/ main script). Edit script if needed to change start/stop time. Test clip to ascertain issue still exists, and upload it somewhere.
 

Attachments

GetLaid

Senior Member
May 10, 2011
102
10
0
I cannot reproduce the problem with the makesample script, maybe because it is not using ffmpeg? Here are the details of one of the files I've tried to convert:

Format : Matroska
Format version : Version 2
File size : 5.44 GiB
Duration : 1h 46mn
Overall bit rate : 7 345 Kbps
Encoded date : UTC 2011-08-05 15:42:04
Writing application : mkvmerge v3.2.0 ('Beginnings') 编译于 Feb 12 2010 16:46:17
Writing library : libebml v0.7.9 + libmatroska v0.8.1

Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : Yes
Format settings, ReFrames : 9 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1h 46mn
Bit rate : 5 843 Kbps
Width : 1 280 pixels
Height : 690 pixels
Display aspect ratio : 1.855
Frame rate : 23.976 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.276
Stream size : 4.21 GiB (77%)
Writing library : x264 core 102 r1666 d058f37
Encoding settings : cabac=1 / ref=9 / deblock=1:-3:-3 / analyse=0x3:0x113 / me=umh / subme=10 / psy=1 / psy_rd=1.05:0.10 / mixed_ref=1 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=2 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=6 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / constrained_intra=0 / bframes=6 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=5843 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=50000 / vbv_bufsize=50000 / ip_ratio=1.40 / aq=1:0.80 / nal_hrd=none
Language : English

Audio
ID : 2
Format : DTS
Format/Info : Digital Theater Systems
Codec ID : A_DTS
Duration : 1h 46mn
Bit rate mode : Constant
Bit rate : 1 510 Kbps
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Compression mode : Lossy
Stream size : 1.12 GiB (21%)
Language : English
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
Video has high compression settings + high bitrate = playback problems on Teg2. Solution: Set video recode = Yes.
 

GetLaid

Senior Member
May 10, 2011
102
10
0
I was worried this might be dead...thanks for the update! This is still my go to program for MKV to MP4 remuxing.

EDIT: By the way, using the newest Zeranoe FFmpeg build is causing errors, any idea why?
 
Last edited:

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
The script mostly functions as intended--getting processed videos onto mobile devices--so there isn't a need to improve it further. The autocrop was added per request, but is actually outside of its design intent. It's added because it was easy to do.

Improvements in 3rd-party video players also made it somewhat redundant, although I still use it on a regular basis to optimize for size. 720p is the preferred res for most, but I recode to 480p for my mobile toys.

The 2MP4 script will get a 2MKV sibling at some point, as MKV should have hardware support in 3rd-party players come next year. If you wonder what's the point, it's to optimize for size and bandwidth, since most mobiles have limited onboard storage, and for streaming from a server, minimizing wifi bandwidth is a priority. MKV is a more flexible container and allows more content options, so it's my preferred output format.

No idea what's up with the new ffmpeg rev. I find a software rev that works and stick with it. Upgrading to latest can cause headaches.

Speaking of fixes, if you've downloaded the 0.2.4 before this post, please reget the slightly revised version. Just grab the 2MP4.CMD script in the folder (the package is also updated). Sorry about that.

NB: If anyone is using the script for smartphones, Android 2.x supports up to 854x480 MP4 in baseline profile, so set options accordingly. That said, most new phones can play 480p high-profile MKV/MP4 in software mode (w/ 3rd-party player).
 
  • Like
Reactions: GetLaid

GetLaid

Senior Member
May 10, 2011
102
10
0
With newer FFMpeg builds, if I remove the -map 0.!_tmp! from this command:

Code:
"%vHome%\ffmpeg" -i "%_in%" -vn -acodec pcm_s16le -ac 2 -f wav - -map 0.!_tmp!
I am now able to get through the audio transcoding phase, whereas before I was getting an error from Nero saying "could not parse WAV file". However, I am unable to complete the muxing phase.

Do you think if the -map commands were reworked we could get newer FFmpeg builds fuctioning?
 

e.mote

Senior Member
Feb 16, 2011
2,165
892
0
I took a look at the latest ffmpeg build. The reason the script breaks is that many of the commands & syntax have either been deprecated or changed significantly.

The audio conversion error is fixable. In abovequoted code line, change -map 0.!_tmp! to -map 0:!_tmp!.

You will still run into problems when muxing. -acodec copy and -vcodec copy are now invalid, and need to be changed to -c copy. And for whatever reason, -alang, which sets language tag for the audio stream, is no longer present in the latest ffmpeg. There may be other changes, although sadly the "non-monotonically increasing dts" bug is still present.

To see differences between old and new ffmpeg, from search screen,
http://google.com/search?q=ffmpeg+"-alang"
click on the main link, then compare it to the cached link.

I'll take another look at it when I have the time.