Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Discussion & Documentation Documentation, Tips & Tricks
  • Search

HOWTO conveniently convert videos using mencoder, x264

Unofficial documentation for various parts of Gentoo Linux. Note: This is not a support forum.
Post Reply
Advanced search
171 posts
  • Page 5 of 7
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next
Author
Message
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Tue May 25, 2010 12:54 pm

Is this

Code: Select all

riptoh264 -p uhq -n Bolt
really the command you use?

-n option activates the specification of the movie title after the inputfile. #

I can't see an inputfile in your command line.

the command you debugged needs the audio id in mplayer specification (zero based, like specified on the command line).
Normally the id is genrated either by grabbing the languages you specified (if language information is avaliable) or by interating over as many audio streams as either are available of as languages are specified.

It seems you ran into a race condition that never occured to me. Could you please verify that your input is valid? In the riptoh264 temporary directory you should have two log files containing commands. Start with testing the command calling avi2mkv and if that one fails try the one calling mkvmerge

2.0.0 was completly rewritten in another programming language, so it seems plausible that the error disappears pre-2.0.0. But I do not have an idea where to start looking for an error right now.
Video Encoding scripts collection | Project page
Top
bigdweeb
n00b
n00b
Posts: 47
Joined: Sun Sep 02, 2007 4:25 am

  • Quote

Post by bigdweeb » Tue May 25, 2010 4:36 pm

I don't know the right syntax honestly, I am still trying to figure your scripts out. I thought I found that syntax somewhere else as an example. I was trying to read right off the disc. Can you give me an example of how to use that tool correctly and I can try again?

I am trying to read off the disc directly and encode into x264 in uhq quality, with English language audio. I would also like to use chapters and maybe subtitles too, but those are secondary wants.
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Wed May 26, 2010 5:45 am

If you want subtitles, then rip the disk to the harddisk first. Else you can buy a new drive before you have your movie!

I changed the default behaviour to assume "directory mode". But I now see, there is no command line option to set "read from disk". You have to set

Code: Select all

riptoh264_directory = no
in the configuration file (or directory => "no" at the beginning of the program code). I will have to fix that.

Oh, I just see, the default in the config file is to put directory = no, which overrides the default. So this is not your problem. I just have to rethink my defaults :twisted: :oops:

Your command line is correct (if you use the default configuration in ~/.fangorn/config). Chaptermarks are transfered automatically. If you want to have only english, either set it to the the default in the config file (remove the language = ger line at the top of the file) or give an additional

Code: Select all

--language eng
on the command line (you can also abbreviate it by -l eng). Subtitles are copied using the -s switch, but as already written, it is advisable to copy the dvd to disk before trying to extract subtitles, because for every subtitle used the movie[/code] is read once, plus two times for the encoding. If I want to be really fast, I even copy the dvd to a RAMdisk before starting. :twisted: Ok, that are the things you do if you have 12 GB of RAM and no need for virtualization at the time. :wink:

If you want to rip to disk firs, I prefer the command

Code: Select all

dvdbackup -M -i /dev/dvd -o . -n <moviename>
Video Encoding scripts collection | Project page
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Tue Jun 01, 2010 4:13 am

bigdweeb, could you please verify (with mediainfo or similar) what audio sources your avi has?

Sorry I came up with this question so late. I was quite busy.
Video Encoding scripts collection | Project page
Top
Brad1213
n00b
n00b
Posts: 7
Joined: Sat Dec 07, 2002 12:52 pm

  • Quote

Post by Brad1213 » Tue Jun 01, 2010 10:27 pm

Using perl 5.8.8 with -w, I got this extra error msg.
Unquoted string "case" may clash with future reserved word at /usr/local/bin/avi2mkv line 922.

Updated perl to 5.10.1, had to unmask these in package.keywords:

Code: Select all

=dev-lang/perl-5.10.1 ~amd64
=sys-devel/libperl-5.10.1 ~amd64
>=app-admin/perl-cleaner-2_pre090920 ~amd64
avi2mkv_2.0.3 now works for me.
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Thu Jun 03, 2010 4:26 am

Ok, that is nice to know. Thanks.

I originally decided to go with the switch/case statements to get compatibility with 5.8 versions of Perl. But I never tested. :oops:

So if I need to depend on 5.10 anyway, I can replace them with given/when statements as Switch.pm will be removed from the standard distribution soon.
Video Encoding scripts collection | Project page
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Thu Jun 10, 2010 8:38 am

@bigdweeb
I just released a new version of avi2mkv where I removed some bad programming style and a few errors. You could try again with this version.

@all
I am just testing new versions of all other programs.
Video Encoding scripts collection | Project page
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Wed Jun 16, 2010 4:17 pm

I just updated all my scripts. Including a completely new perl version of blu2mkv. For a complete write up on the new versions, see the project page.

As this is the last major program to port, I may have time for other things at my hands now. :roll:
Video Encoding scripts collection | Project page
Top
bobspencer123
Guru
Guru
User avatar
Posts: 544
Joined: Mon Dec 19, 2005 1:50 am

  • Quote

Post by bobspencer123 » Thu Jul 08, 2010 3:00 pm

just trying out these scripts (specifically the riptoh264) and getting this error:

Code: Select all


# riptoh264 BEO0NNF1/ test.mkv
###### the BEO0NNF1 is a dvd directory structure that was ripped to hd using dvdfab under wine
starting options testing
Encoding Movie BEO0NNF1 from device BEO0NNF1
encoding Title 1 which has 11 chapters
Volume ID: unknown
Disc ID:
Starting Processing. This can take a while. Please be patient.
  Title 1: has 11 chapters and is  seconds long
Use of uninitialized value in scalar chomp at /home/kundera/scripts/toolbox_fangorn line 1229.
Use of uninitialized value in scalar chomp at /home/kundera/scripts/toolbox_fangorn line 1232.
Use of uninitialized value in scalar chomp at /home/kundera/scripts/toolbox_fangorn line 1235.
Use of uninitialized value in division (/) at /home/kundera/scripts/toolbox_fangorn line 1236.
Use of uninitialized value in division (/) at /home/kundera/scripts/toolbox_fangorn line 1236.
Illegal division by zero at /home/kundera/scripts/toolbox_fangorn line 1236.
I have edited the location part for toolbox_fangorn in the riptoh264 script to point towards my script directory which is in my path.

Any ideas appreciated.


EDIT Using the -d switch solved this.
Increasingly becoming a 2 channel audio nut!
Top
bobspencer123
Guru
Guru
User avatar
Posts: 544
Joined: Mon Dec 19, 2005 1:50 am

  • Quote

Post by bobspencer123 » Thu Jul 08, 2010 5:59 pm

for some reason the script is outputting an avi instead of an mkv.

here is the command I'm using now:

Code: Select all

riptoh264 -aa -a2 -d BEO0NNF1/ test.mkv
I also tried it with the -n switch before test.mkv

here is the mencoder log:

Code: Select all

skip telecining detection, using preset Method: 24000/1001p soft telecined to 30000/1001t
/usr/local/bin/choose_video_parameters -o tmpdir_BEO0NNF1/BEO0NNF1_x264_encoding_parameters.txt  -f 29.970 -p nq  -w 720  -h 480 -W 720 -H 480  -B 1200
using seleted preset nq
geometryfilteroptions
Using filterset:
common filters: lavcdeint
first pass:  -vf lavcdeint
second pass:  -vf lavcdeint
nice -n 10 /usr/bin/mencoder  -dvd-device BEO0NNF1 dvd://1 -aid 128  -vf lavcdeint  -ovc x264 -x264encopts mixed_refs:nombtree:partitions=p8x8,b8x8,i4x4:deblock:no8x8dct:bframes=10:weightp=1:me=hex:aq_mode=2:weight_b:cabac:keyint=300:chroma_me:b_pyramid=normal:bitrate=1200:direct_pred=spatial:subq=5:nodct_decimate:frameref=3:nofast_pskip:trellis=1:level_idc=41:b_adapt=1:threads=auto:ssim:psnr:pass=1:turbo=2 -passlogfile tmpdir_BEO0NNF1/BEO0NNF1_2pass.log  -oac copy  -o tmpdir_BEO0NNF1/BEO0NNF1_tmp.avi
it also looks like the aac flag isn't being passed too. I also tried using the -mp4 flag and still avi file.


EDIT well I think I figured out that an avi is first created then it is muxed? / converted? to matroska. I let the whole run but then ended up with zero files and a cryptic message about next time try using an input file. I lost the exact message. I will try again tonite when I'm actually home on the computer instead of ssh and see if I can reproduce the problem.
Increasingly becoming a 2 channel audio nut!
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Fri Jul 09, 2010 5:24 am

You should have a config file in your /home/<username>/.fangorn/config

Activate debug mode by setting
debug = yes
in the config file. Or give the --debug flag on the command line. Then the temporary directory does not get cleaned away.

to clear the concept up a little:
I use multiple scripts for encoding - riptoh264 for dvds, blu2mkv for HD content and menc for the rest - who all use mencoder
to produce a valid h.264 video stream and audio in an AVI container (because this one is best supported by mencoder).
Then all the scripts call avi2mkv to mux the video and audio to other containers and maybe convert the audio on the fly if necessary.

riptoh264 in directory mode (which takes iso files also) is using the name of the directory as name of the movie by default.
If - like in your case - the directory is not named after the movie, you can provide the -n option and specify a name for the
movie at the end of the command line. I know this is inconsistant, but it is as it is for compatibility reasons with earlier versions.
In no way you have to specify the extension. This is selected by avi2mkv when finally muxing.

A "correct" command line would be

Code: Select all

riptoh264 --debug -dn BEO0NNF1 <moviename>
it is <moviename>, not <filename>

Now to the specific error message. It seems the script cannot fully read the dvd structure. Have you tried playing it with mplayer

Code: Select all

mplayer -dvd-device BEO0NNF1 dvd://
or you could see if lsdvd can read the dvd structure correctly.

Edit:
And I think when you are using "long options" (even when they are the short version :twisted: ) it is recommended to use --aa --a2. The documentation for Getopt::Long is not very clear about that, but I do not think that this works for sure with just one -

But if these are the options you found working best for you, you can also set them in the config file.

If you want aac audio in a Matroska container, the support for audio conversion for matroska containers is quite young in avi2mkv and therefore not very well tested. I would start without audio conversion and if that works you can alway start another muxing session with an edited avi2mkv command line.
Video Encoding scripts collection | Project page
Top
bobspencer123
Guru
Guru
User avatar
Posts: 544
Joined: Mon Dec 19, 2005 1:50 am

  • Quote

Post by bobspencer123 » Mon Jul 12, 2010 11:54 am

riptoh264 --debug -dn BEO0NNF1 <moviename>


this command worked. I will just use a script I wrote myself (for now) to change the audio to aac and mux container to mp4.

Thanks!
Increasingly becoming a 2 channel audio nut!
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Tue Jul 13, 2010 4:20 am

You can do that, but if you find the time, please test avi2mkv for this job, as it is its own domain.

As my hardware is not so keen of MP4 and AAC (it plays, but MKV is supported better) my production
muxing goes into MKV. I ran just a few test cases, that worked for me. So I could use the input from
a tester that actually prefers MP4.
Video Encoding scripts collection | Project page
Top
PraetorZero
Apprentice
Apprentice
User avatar
Posts: 239
Joined: Sat Dec 11, 2004 4:18 am
Location: /home

  • Quote

Post by PraetorZero » Mon Aug 09, 2010 2:19 am

Try as I might, I haven't had much success with this.

Code: Select all

blu2mkv 00004.m2ts 1 --on war.mkv
Switch will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at /usr/local/bin/toolbox_fangorn, line 41.
Outputfile set to war.mkv
/usr/bin/mplayer 00004.m2ts -msglevel identify=6 -frames 0 -identify -vc null -vo null -ao null 2>/dev/null 
/usr/bin/ffmpeg -i 00004.m2ts 2>&1
Source file is of Type Unknown :(
Width = 1920
Height = 1080
Aspect = 1.77777777777778
Aspect should be 1.77777777777778
Source Framerate: 23.976
Input Framerate used: 24000/1001
Output Framerate used: 24000/1001
Resolution = 1280:720
Do not scale is yes
video is interlaced: no
dynamic noise reduction is active: 
Toolbox detect_crop
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
Argument "[CROP] Crop area" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1258.
Argument " X" isn't numeric in numeric lt (<) at /usr/local/bin/toolbox_fangorn line 1265.
resizing video to 720p
calling external program choose_video_parameters
/usr/local/bin/choose_video_parameters    -f 23.976 -o tmpdir_war.mkv/war.mkv_x264_encoding_parameters.txt -p nq  -w 1280  -h 720 -W 1920 -H 1080 -c 0:0:0:0 -B 4000
-> Using "Normal Quality" preset
Illegal division by zero at /usr/local/bin/choose_video_parameters line 592.
external call was successfull
using seleted preset nq
geometryfilteroptions: 
Filter used for pass 1: 
Filter used for pass 1: crop=0:0:0:0
geometry options used for pass 1: 
Filter used for pass 1: crop=0:0:0:0
Filter used for pass 1: crop=0:0:0:0
Filter used for pass 1: crop=0:0:0:0,hqdn3d=2:1:2
Filter used for pass 1: crop=0:0:0:0,hqdn3d=2:1:2,harddup
Filter used for pass 2: crop=0:0:0:0,hqdn3d=2:1:2,harddup
video filters used for first pass: crop=0:0:0:0,hqdn3d=2:1:2,harddup
AUDIO channel used  -aid 0
MEncoder SVN-r31947-4.4.4 (C) 2000-2010 MPlayer Team
Option x264encopts: turbo option is deprecated; use slow_firstpass to disable turbo
success: format: 0  data: 0x0 - 0x55b27800
TS file format detected.
VIDEO VC1(pid=4113) NO AUDIO!  NO SUBS (yet)!  PROGRAM N. 1
Searching for VC1 sequence header... found
VIDEO:  VC-1  1920x1080, 23.976 fps, header len: 33
[V] filefmt:29  fourcc:0x31435657  size:1920x1080  fps:23.976  ftime:=0.0417
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Requested video codec family [wmvvc1dmo] (vfm=dmo) not available.
Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x264 [info]: profile Main, level 4.1
Pos:   0.0s      1f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]

1 duplicate frame(s)!
Writing header...
ODML: vprp aspect is 16:9.
Writing header...
ODML: vprp aspect is 16:9.
Pos:   0.0s     25f ( 0%)  0.00fps Trem:   0min   0mb  A-V:0.000 [0:0]
Writing header...
ODML: vprp aspect is 16:9.
Pos: 130.7s   3158f ( 2%) 29.73fps Trem:  79min 2773mb  A-V:0.000 [3873:0]

Too many audio packets in the buffer: (4096 in 10485760 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
Pos: 130.8s   3159f ( 2%) 29.73fps Trem:  79min 2775mb  A-V:0.000 [3875:0]

Too many audio packets in the buffer: (4096 in 10485760 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.
File not found: 'crop=0:0:0:0,hqdn3d=2:1:2,harddup'
Failed to open crop=0:0:0:0,hqdn3d=2:1:2,harddup.
Cannot open file/device.

Exiting...
video filters used for second pass: crop=0:0:0:0,hqdn3d=2:1:2,harddup
MEncoder SVN-r31947-4.4.4 (C) 2000-2010 MPlayer Team
success: format: 0  data: 0x0 - 0x55b27800
TS file format detected.
VIDEO VC1(pid=4113) NO AUDIO!  NO SUBS (yet)!  PROGRAM N. 1
Searching for VC1 sequence header... found
VIDEO:  VC-1  1920x1080, 23.976 fps, header len: 33
[V] filefmt:29  fourcc:0x31435657  size:1920x1080  fps:23.976  ftime:=0.0417
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Requested video codec family [wmvvc1dmo] (vfm=dmo) not available.
Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x264 [error]: bad frame number (3137) at stats line 3133
x264_encoder_open failed.
FATAL: Cannot initialize video driver.

Exiting...
Switch will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at /usr/local/bin/toolbox_fangorn, line 41.
movie title is war.mkv
using war.mkv.avi as source
Use of uninitialized value in scalar chomp at /usr/local/bin/toolbox_fangorn line 1229.
Use of uninitialized value in scalar chomp at /usr/local/bin/toolbox_fangorn line 1232.
Use of uninitialized value in scalar chomp at /usr/local/bin/toolbox_fangorn line 1235.
Use of uninitialized value in division (/) at /usr/local/bin/toolbox_fangorn line 1236.
Use of uninitialized value in division (/) at /usr/local/bin/toolbox_fangorn line 1236.
Illegal division by zero at /usr/local/bin/toolbox_fangorn line 1236.
And this is from .fanghorn/config

Code: Select all

profile                        = nq
containerformat                = mkv
debug                          = yes
bluray_repeats                 = 1
bluray_seconds                 = 300
bluray_dups                    = 1
bluray_chapter                 = no
bluray_subtitleconvert         = no
bluray_fps                     = 0
bluray_videoformat             = keep
bluray_reduce_streams          = yes
bluray_extract_core            = no
bluray_start_tsMuxeR           = no
avi2mkv_audiotarget            = copy
avi2mkv_normalize_audio        = no
avi2mkv_setaudiovolume         =
avi2mkv_usestereo              = no
avi2mkv_pan                    = 
avi2mkv_channels               = 
blu2mkv_resolution             = 1280:720
blu2mkv_bitrate                = 6000 
blu2mkv_cropborders            = yes
blu2mkv_expandvideo            = no
blu2mkv_extractcorestream      = no
blu2mkv_interlaced             = no
blu2mkv_process_subtitles      = no
blu2mkv_convert_sup            = no
blu2mkv_TMPPATH = 
blu2mkv_OUTPUTPATH = 
riptoh264_noisereduction       = no
riptoh264_interlaced           = no
riptoh264_crop                 = no
riptoh264_expandvideo          = no
riptoh264_expandif             = no
riptoh264_secondaudiofirst     = no
riptoh264_subtitles            = no
riptoh264_processallsubs       = no
riptoh264_ripall               = no
riptoh264_min_title_length     = 120
riptoh264_TMPPATH              = 
riptoh264_OUTPUTPATH           = 
riptoh264_FORMAT               = PAL
riptoh264_BITRATE              = 1200
riptoh264_audiotarget          = copy
riptoh264_singleaudio          = no
riptoh264_directory            = no
riptoh264_TELECINE_METHOD      = 25p telecined to 25i
riptoh264_rawcommand = 
riptoh264_override_video_encoder    =
This is using an updated mplayer ebuild with a new snapshot as of today. (31947) and perl-5.12.1-r1.

I should explain what happens. It appears to make the first pass fine, but when it comes to the second pass is when it crashes. I can play the temporary file during the initial run, as it is still encoding. However, the resolution is still 1920x1080. As I understand the config file, I've requested that it be resized to 1280x720 with the matted black bars to be cropped. I'm assuming when it comes to the second run, it fails and the temporary AVI is deleted and recreated with a 0 byte size.

So, my big question is: what am I doing wrong? Why is it failing, why is the temporary file still 1080p instead of 720p?
What's the worst that can happen?
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Tue Aug 10, 2010 7:38 am

blu2mkv 00004.m2ts 1 --on war.mkv
I do not see what you are trying to do with this command. AFAIK I did not program an option --on
and the 1 (which did address an audiostream in earlier versions) does not address an audio stream
in MPEG Transport STream format. Also, in my experience, mencoder did have problems with
reencoding M2TS files directly. Also there is the problem that most Bluray productions compose
the Titles of multiple containers and that M2TS has no information of language codes or chapter
marks or such things. For such cases I have written bluray-info. It reads information from
AVCHD/Bluray Productions (the playlists) and can extract titles to .ts containers, preserving
information about languages, chapter, subtitles, ...

the tested procedure would be:
rename the source directory to something meaningful (in your case (war)
process the directory containing the BDMV directory with bluray-info
extract the main feature (mostly, but not always the longest item in the playlist)
blu2mkv <file.ts>
[/code]

If you just want one language, edit the config file and bluray-info will extract only audio and
subtitle streams of that language.

As a further tip: mencoder had problems using twopass encoding with the mbtree option before.
see the <moviename>_mencoder.log for detailed information what went wrong.

If the problems continue, post the mencoder.log.

edit: those darn long lines
fangorn
Video Encoding scripts collection | Project page
Top
PraetorZero
Apprentice
Apprentice
User avatar
Posts: 239
Joined: Sat Dec 11, 2004 4:18 am
Location: /home

  • Quote

Post by PraetorZero » Tue Aug 10, 2010 11:39 am

Code: Select all

    --specify-output-name|--on
         specify output name for the video file
This is what I was after regarding that trigger. The .mt2s has 6? audio streams. I have english selected as the default on the config file. IIRC, it fails regardless if I specify the audio track at the command line. I did use tsmuxer to change from .mt2s to .ts as I re-read your original post regarding blu2mkv without much success.

I will try again leaving the config file settings as I noted without any command line switches activated.
What's the worst that can happen?
Top
PraetorZero
Apprentice
Apprentice
User avatar
Posts: 239
Joined: Sat Dec 11, 2004 4:18 am
Location: /home

  • Quote

Post by PraetorZero » Tue Aug 10, 2010 12:04 pm

edit: those darn long lines
I found this little scriptlet on a forum a few years back that works perfect in cases like this. Just save it as a bookmark and hit it when you run into pages like this.

Code: Select all

javascript:(function(){var%20D=document;F(D.body);function%20F(n){var%20u,r,c,x;if(n.nodeType==3){u=n.data.search(/\S{45}/);if(u>=0){r=n.splitText(u+45);n.parentNode.insertBefore(D.createElement('wbr'),r);}}else%20if((n.tagName!='STYLE')&&(n.tagName!='SCRIPT')){for(c=0;x=n.childNodes[c];++c){F(x);}}}D.body.innerHTML+='%20';})();
What's the worst that can happen?
Top
PraetorZero
Apprentice
Apprentice
User avatar
Posts: 239
Joined: Sat Dec 11, 2004 4:18 am
Location: /home

  • Quote

Post by PraetorZero » Wed Aug 11, 2010 3:12 am

With only one modification to my posted config, I'm still experiencing the same issue with a muxed .ts file.

Executing "blu2mkv clones.ts"

Code: Select all

ls -lh tmpdir_clones/
total 16M
-rw-r--r-- 1 me me    0 Aug 10 21:56 clones.avi
-rw-r--r-- 1 me me  16M Aug 10 21:56 clones_2pass.log
-rw-r--r-- 1 me me 1.5K Aug 10 21:56 clones_blu2mkv_command.log
-rw-r--r-- 1 me me  307 Aug 10 20:32 clones_x264_encoding_parameters.txt

clones_2pass.log First line only.

Code: Select all

#options: 1920x1080 fps=24000/1001 timebase=1001/24000 cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 
psy_rd=0.00:0.00 mixed_ref=0 me_range=16 chroma_me=0 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 
threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 constrained_intra=0 bframes=6 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 
weightb=0 weightp=0 keyint=240 keyint_min=24 scenecut=40 intra_refresh=0 rc=abr mbtree=0 bitrate=4000 ratetol=1.0 qcomp=0.60 
qpmin=10 qpmax=51 qpstep=4 ip_ratio=1.40 pb_ratio=1.30 aq=2:1.00
Remaining snipped.

clones_blu2mkv_command.log

Code: Select all

Available audio streams: 4352 4353 4354 4355 4356 4357 4358 4359 4360
/usr/bin/mplayer  -aid 4352 clones.ts -identify -frames 0 -vc null -vo null -ao null  2>&1
Detecting crop window: 
0:0:0:0
/usr/local/bin/choose_video_parameters    -f 23.976 -o tmpdir_clones/clones_x264_encoding_parameters.txt -p lq  -w 1280  -h 720 -W 1920 -H 1080 -c 0:0:0:0 -B 4000
nice -n 10  /usr/bin/mencoder clones.ts  -aid 4352 -oac copy   -nosub  -ovc x264 -x264encopts nomixed_refs:nombtree:partitions=p8x8,b8x8,i4x4:deblock:no8x8dct:bframes=6:weightp=0:me=dia:aq_mode=2:noweight_b:cabac:keyint=240:
nochroma_me:b_pyramid=normal:bitrate=4000:direct_pred=spatial:subq=4:dct_decimate:frameref=2:nofast_pskip:trellis=0:level_idc=41:b_adapt=1:threads=auto:ssim:psnr:pass=1:turbo=2 -passlogfile tmpdir_clones/clones_2pass.log crop=0:0:0:0,hqdn3d=2:1:2,harddup -fps 
24000/1001 -ofps 24000/1001 -o tmpdir_clones/clones.avi
nice -n 10  /usr/bin/mencoder clones.ts  -aid 4352 -oac copy  -nosub  -ovc x264 -x264encopts 
nomixed_refs:nombtree:partitions=p8x8,b8x8,i4x4:deblock:no8x8dct:bframes=6:weightp=0:me=dia:aq_mode=2:noweight_b:cabac:keyint=240:nochroma_me:b_pyramid=normal:bitrate=4000:direct_pred=spatial:subq=4:dct_decimate:frameref=2:nofast_pskip:trellis=0:level_idc=41:b_ad
apt=1:threads=auto:ssim:psnr:pass=2 -passlogfile tmpdir_clones/clones_2pass.log crop=0:0:0:0,hqdn3d=2:1:2,harddup -fps 24000/1001 -ofps 24000/1001 -o tmpdir_clones/clones.avi
/usr/local/bin/avi2mkv        -p lq     -t clones clones.avi 
clones_x264_encoding_parameters.txt

Code: Select all

x264encoptions nomixed_refs:nombtree:partitions=p8x8,b8x8,i4x4:deblock:no8x8dct:bframes=6:weightp=0:me=dia:aq_mode=2:noweight_b:cabac:keyint=240:
nochroma_me:b_pyramid=normal:bitrate=4000:direct_pred=spatial:subq=4:dct_decimate:frameref=2:nofast_pskip:trellis=0:level_idc=41:b_ad
apt=1:threads=auto:ssim:psnr
All of this terminates with:

Code: Select all

ODML: Starting new RIFF chunk at 3071MB.
Pos:5904.6s 141571f (99%) 27.92fps Trem:   0min 3254mb  A-V:-0.051 [3979:640]
TS_PARSE: COULDN'T SYNC
Pos:5904.6s 141572f (99%) 27.92fps Trem:   0min 3253mb  A-V:-0.047 [3979:640]
File not found: 'crop=0:0:0:0,hqdn3d=2:1:2,harddup'
Failed to open crop=0:0:0:0,hqdn3d=2:1:2,harddup.
Cannot open file/device.

Exiting...
video filters used for second pass: crop=0:0:0:0,hqdn3d=2:1:2,harddup
MEncoder SVN-r31947-4.4.4 (C) 2000-2010 MPlayer Team
success: format: 0  data: 0x0 - 0x12a2b204
TS file format detected.
VIDEO VC1(pid=4113) AUDIO A52(pid=4352) NO SUBS (yet)!  PROGRAM N. 1
Searching for VC1 sequence header... found
VIDEO:  VC-1  1920x1080, 23.976 fps, header len: 33
[V] filefmt:29  fourcc:0x31435657  size:1920x1080  fps:23.976  ftime:=0.0417
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 640.0 kbit/41.67% (ratio: 80000->192000)
Selected audio codec: [ffac3] afm: ffmpeg (FFmpeg AC-3)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Requested video codec family [wmvvc1dmo] (vfm=dmo) not available.
Enable it at compilation.
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffvc1] vfm: ffmpeg (FFmpeg WVC1)
==========================================================================
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=80000 sample-1)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x264 [error]: bad frame number (141554) at stats line 141548
x264_encoder_open failed.
FATAL: Cannot initialize video driver.

Exiting...
Switch will be removed from the Perl core distribution in the next major release. Please install it from CPAN. It is being used at /usr/local/bin/toolbox_fangorn, line 41.
movie title is clones
Use of uninitialized value in scalar chomp at /usr/local/bin/toolbox_fangorn line 1229.
Use of uninitialized value in scalar chomp at /usr/local/bin/toolbox_fangorn line 1232.
Use of uninitialized value in scalar chomp at /usr/local/bin/toolbox_fangorn line 1235.
Use of uninitialized value in division (/) at /usr/local/bin/toolbox_fangorn line 1236.
Use of uninitialized value in division (/) at /usr/local/bin/toolbox_fangorn line 1236.
Illegal division by zero at /usr/local/bin/toolbox_fangorn line 1236.
As you can see, the temporary file is 3071MB before it starts drops out with the divide by zero error. Somewhere, it's zeroing out the temp file.
What's the worst that can happen?
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Wed Aug 11, 2010 7:30 am

The problem why the encoding is not happening is that the mencoder line misses a "-vf " swtich before the crop= and other
filter options. I did not run into such an error for a long time (and I use this script multiple times a week). I will have to look into it.
Also the crop parameters are empty, so it seems your source is already in full 16:9 format without black borders. But normally
it does not use crop parameters then. Besides that the scale= parameters are missing to go from 1080p to 720p. Your settings
in config file seem to be correct. I will have to test this.

As for audio streams: blu2mkv prefers audio streams with the language information set. (all of them, not just the ones you want).
If none are set, it takes the first <number_of_audio_streams_wanted>, which is most likely not what you wanted - besides
you specially prepared the source.
If only some of the streams have language information, blu2mkv will most probably fail.
Video Encoding scripts collection | Project page
Top
PraetorZero
Apprentice
Apprentice
User avatar
Posts: 239
Joined: Sat Dec 11, 2004 4:18 am
Location: /home

  • Quote

Post by PraetorZero » Wed Aug 11, 2010 11:23 am

fangorn wrote:The problem why the encoding is not happening is that the mencoder line misses a "-vf " swtich before the crop= and other
filter options. I did not run into such an error for a long time (and I use this script multiple times a week). I will have to look into it.
Also the crop parameters are empty, so it seems your source is already in full 16:9 format without black borders. But normally
it does not use crop parameters then. Besides that the scale= parameters are missing to go from 1080p to 720p. Your settings
in config file seem to be correct. I will have to test this.

As for audio streams: blu2mkv prefers audio streams with the language information set. (all of them, not just the ones you want).
If none are set, it takes the first <number_of_audio_streams_wanted>, which is most likely not what you wanted - besides
you specially prepared the source.
If only some of the streams have language information, blu2mkv will most probably fail.
The source does have black bars. I can do a crop detect in mplayer and it provides me with -vf crop=1920:784:0:150. The text in the config file states:

Code: Select all

# automatically expand video geometry to reach 16/9 aspect ratio
# (by appending black borders)? (yes or no)
so I was under the impression that this should be set to 'no' since I'm trying to avoid said black bars.

I appreciate any help you can give me. :)
What's the worst that can happen?
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Wed Aug 11, 2010 5:38 pm

As said, I think your settings in the config file are valid.

I will look into the problem at the weekend. It seems I did not test this case.
Video Encoding scripts collection | Project page
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Sat Aug 14, 2010 3:31 am

I just released fixed versions of blu2mkv, toolbox_fangorn and choose_video_profile.

PraetorZero please test.

These versions of the helper scripts is widely untested with the other programs!
Video Encoding scripts collection | Project page
Top
bssteph
l33t
l33t
User avatar
Posts: 653
Joined: Wed Feb 26, 2003 12:33 am
Location: Wisconsin
Contact:
Contact bssteph
Website

  • Quote

Post by bssteph » Sat Aug 14, 2010 7:40 pm

Kind of new to the whole encoding thing, but using these scripts (version from a couple days ago, I haven't tried the Friday update yet), any ideas why the .mkv output of riptoh264 would play fine in mplayer but not in xine? xine complains about dropped frames and only has a black screen until it seeks a bit and then "finishes". Interested in any suggestions.

Also, when I used riptoh264 -l jpn -l eng and had the order the other way in my config (language = eng, language = jpn), it extracted the audio in the command line order, but labeled them in the config file order (so jpn was labeled eng, and vice versa). Bug?
Top
PraetorZero
Apprentice
Apprentice
User avatar
Posts: 239
Joined: Sat Dec 11, 2004 4:18 am
Location: /home

  • Quote

Post by PraetorZero » Sun Aug 15, 2010 4:11 am

fangorn wrote:I just released fixed versions of blu2mkv, toolbox_fangorn and choose_video_profile.

PraetorZero please test.

These versions of the helper scripts is widely untested with the other programs!
Well, it completes this time around. This is a huge improvement! :)

I'm puzzled with the dimensions of the resulting video, but I think that's just me misunderstanding something. Thank you for the updates!
What's the worst that can happen?
Top
fangorn
Veteran
Veteran
User avatar
Posts: 1886
Joined: Sat Jul 31, 2004 1:31 pm
Contact:
Contact fangorn
Website

  • Quote

Post by fangorn » Mon Aug 16, 2010 7:28 am

@PraetorZero
The dimensions result from my scripts trying to be as compatible as possible. So they use geometry in a 16x16 block design.
This is not really necessary most of the time, but it does not hurt (much). :roll:

@bssteph
I dont really know anything about xine. I have given up on every application using it a long time ago. There are alternatives that "just work".

For your language order question: That is also a case I did not think of for testing. I will look into it.
Video Encoding scripts collection | Project page
Top
Post Reply

171 posts
  • Page 5 of 7
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • Next

Return to “Documentation, Tips & Tricks”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic