Skip to content

Commit

Permalink
simplify things, use pandoc, add codesetup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Gavin Beatty committed Dec 26, 2012
1 parent 4f04dbd commit 900a94c
Show file tree
Hide file tree
Showing 12 changed files with 498 additions and 1,115 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
build
dist
simplemkv/version.py
*.pyc
MANIFEST
14 changes: 0 additions & 14 deletions MANIFEST

This file was deleted.

29 changes: 11 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,35 +1,28 @@
TMPDIR=/tmp

RM = rm -f
A2X = a2x
ASCIIDOC = asciidoc
INSTALL = install
PANDOC = pandoc

default: doc
.PHONY: default

PROJECT = mkvtomp4
include man2txt.mk

doc: doc/$(PROJECT).1 doc/$(PROJECT).1.html doc/$(PROJECT).txt
.PHONY: doc

doc/$(PROJECT).1: doc/$(PROJECT).1.txt
$(A2X) -f manpage -L doc/$(PROJECT).1.txt
$(PANDOC) -s -w man -o doc/$(PROJECT).1 doc/$(PROJECT).1.txt
doc/$(PROJECT).1.html: doc/$(PROJECT).1.txt
$(ASCIIDOC) doc/$(PROJECT).1.txt
doc/$(PROJECT).txt: doc/$(PROJECT).1
$(call man2txt,doc/$(PROJECT).1,doc/$(PROJECT).txt)
clean:
$(PANDOC) -s -w html -o doc/$(PROJECT).1.html doc/$(PROJECT).1.txt
doc/$(PROJECT).txt: doc/$(PROJECT).1.txt
$(PANDOC) -s -w plain -o doc/$(PROJECT).txt doc/$(PROJECT).1.txt
clean-doc:
$(RM) doc/$(PROJECT).1 doc/$(PROJECT).1.html doc/$(PROJECT).txt
.PHONY: clean-doc
clean-pyc:
find . -name '*.pyc' -print0 | xargs -0 rm -f
.PHONY: clean-pyc
clean: clean-doc clean-pyc
.PHONY: clean
#easy_install_doc: doc/$(PROJECT).1 doc/$(PROJECT).1.html doc/$(PROJECT).1.txt
# @$(RM) $(DISTNAME)-doc.zip
# @mkdir -p $(DISTNAME)-doc
# @$(INSTALL) -m 0644 doc/$(PROJECT).1.html $(DISTNAME)-doc/index.html
# $(ZIP) $(DISTNAME)-doc.zip $(DISTNAME)-doc/index.html >/dev/null
# @$(RM) -r $(DISTNAME)-doc
#.PHONY: easy_install_doc

pep8:
@find . -name '*.py' -print0 | xargs -0 pep8
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ Everything else is written using only fully cross-platform python, except:

If you want to help eliminate this dependency, help solve issue 0001.


Install
-------

Install code and documentation using setup.py in the standard way.

Install only code using codesetup.py.

5 changes: 5 additions & 0 deletions codesetup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from setup import *
if __name__ == '__main__':
__version__ = git_version()
codeopts['version'] = __version__
setup(**codeopts)
311 changes: 158 additions & 153 deletions doc/mkvtomp4.1
Original file line number Diff line number Diff line change
@@ -1,154 +1,159 @@
'\" t
.\" Title: mkvtomp4
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
.\" Date: 02/27/2010
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MKVTOMP4" "1" "02/27/2010" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
mkvtomp4 \- convert H\&.264 mkv files to mp4 files playable on the PS3
.SH "SYNOPSIS"
.sp
\fBmkvtomp4\fR [\fIOPTIONS\fR] [\-\-] \fI<mkvfile>\fR
.sp
\fBmkvtomp4\fR \fB\-\-correct\-profile\-only\fR [\-\-] \fI<rawh264file>\fR
.SH "DESCRIPTION"
.sp
Uses mpeg4ip or GPAC\(cqs MP4Box, mkvtoolnix and ffmpeg to convert troublesome mkv files to mp4\&. The conversion does not re\-encode the video and only re\-encodes the audio if it doesn\(cqt use AAC codec (one can override this behaviour using \fB\-\-audio\-codec\fR)\&. They will be playable on the Sony PS3\&.
.sp
We depend on: \fBmkvtoolnix\fR, \fBmpeg4ip\fR or GPAC\(cqs \fBMP4Box\fR for the conversion\&. \fBffmpeg\fR is optional but required for audio transcoding\&.
.SH "OPTIONS"
.PP
\fB\-\-use\-mp4creator\fR or \fB\-\-use\-mp4box\fR
.RS 4
Specify which mp4 backend to use\&. mp4creator is the default\&.
.RE
.PP
\fB\-\-audio\-delay\-ms\fR=\fI<delay_ms>\fR
.RS 4
When importing the audio track, delay by
\fI<delay_ms>\fR
milliseconds\&. e\&.g\&.,
\fB\-\-audio\-delay\-ms\fR=\fI1000\fR
delays by 1 second\&. Not supported by mp4creator\&.
.RE
.PP
\fB\-\-audio\-bitrate\fR=\fI<bitrate>\fR
.RS 4
If/When converting audio, use the given bitrate\&. e\&.g\&.,
\fI128\fR\&.
.RE
.PP
\fB\-\-audio\-channels\fR=\fI<channels>\fR
.RS 4
If/When converting audio, use
\fI<channels>\fR
channels in the output\&. e\&.g\&.,
\fI5\&.1\fR\&.
.RE
.PP
\fB\-\-audio\-codec\fR=\fI<codec>\fR
.RS 4
If/When converting audio, convert to
\fI<codec>\fR\&. Default is
\fIlibfaac\fR\&. This should be something supported by
\fBffmpeg\fR\&.
.RE
.PP
\fB\-o, \-\-output\fR=\fI<outfile>\fR
.RS 4
Put the completed mp4 into
\fI<outfile>\fR\&.
.RE
.PP
\fB\-\-keep\-temp\-files\fR
.RS 4
Keep all temporary files created while converting\&.
.RE
.PP
\fB\-n, \-\-dry\-run\fR
.RS 4
Don\(cqt run any commands, but print them in a shellquoted format that can be safely copy\-pasted by the user\&.
.RE
.PP
\fB\-\-stop\-before\-extract\-video\fR
.RS 4
Exit before extracting video from
\fI<mkvfile>\fR\&.
.RE
.PP
\fB\-\-stop\-before\-correct\-profile\fR
.RS 4
Exit before correcting profile of raw H\&.264 stream\&.
.RE
.PP
\fB\-\-stop\-before\-extract\-audio\fR
.RS 4
Exit before extracting audio from
\fI<mkvfile>\fR\&.
.RE
.PP
\fB\-\-stop\-before\-convert\-audio\fR
.RS 4
Exit before converting audio previously extracted\&. This will stop even if the audio does not need to be converted\&.
.RE
.PP
\fB\-\-stop\-before\-video\-mp4\fR
.RS 4
Exit before adding the extracted video to the mp4 container\&.
.RE
.PP
\fB\-\-stop\-before\-hinting\-mp4\fR
.RS 4
Exit before hinting the mp4 file with the video track\&.
.RE
.PP
\fB\-\-stop\-before\-audio\-mp4\fR
.RS 4
Exit before adding the extracted (and possibly converted) audio to the mp4 container\&.
.RE
.PP
<mkvfile>
.RS 4
The Matroska (\&.mkv) file you wish to convert\&.
.RE
.PP
\fB\-\-correct\-profile\-only\fR
.RS 4
.TH MKVTOMP4 1 "December 26, 2012"
.SH NAME
.PP
mkvtomp4 - convert H.264 mkv files to mp4 files playable on the PS3
.SH SYNOPSIS
.PP
\f[I]mkvtomp4\f[] [\f[I]OPTIONS\f[]] [--] \f[I]<mkvfile>\f[]
.PP
\f[I]mkvtomp4\f[] \f[I]--correct-profile-only\f[] [--]
\f[I]<rawh264file>\f[]
.SH DESCRIPTION
.PP
Uses mpeg4ip or GPAC\[aq]s MP4Box, mkvtoolnix and ffmpeg to convert
troublesome mkv files to mp4.
The conversion does not re-encode the video and only re-encodes the
audio if it doesn\[aq]t use AAC codec (one can override this behaviour
using \f[C]--audio-codec\f[]).
They will be playable on the Sony PS3.
.PP
We depend on: \f[I]mkvtoolnix\f[], \f[I]mpeg4ip\f[] or GPAC\[aq]s
\f[I]MP4Box\f[] for the conversion.
\f[I]ffmpeg\f[] is optional but required for audio transcoding.
.SH OPTIONS
.TP
.B --use-mp4creator, --use-mp4box
Specify which mp4 backend to use.
mp4creator is the default.
.RS
.RE
.TP
.B --audio-delay-ms=\f[I]\f[]
When importing the audio track, delay by \f[C]\\<delay_ms>\f[]
milliseconds.
e.g., \f[C]--audio-delay-ms\f[]=\f[C]1000\f[] delays by 1 second.
Not supported by mp4creator.
.RS
.RE
.TP
.B --audio-bitrate=\f[I]<bitrate>\f[]
If/When converting audio, use the given bitrate.
e.g., \f[C]128\f[].
.RS
.RE
.TP
.B --audio-channels=\f[I]<channels>\f[]
If/When converting audio, use \f[C]\\<channels>\f[] channels in the
output.
e.g., \f[C]5.1\f[].
.RS
.RE
.TP
.B --audio-codec=\f[I]<codec>\f[]
If/When converting audio, convert to \f[C]\\<codec>\f[].
Default is \f[C]libfaac\f[].
This should be something supported by \f[I]ffmpeg\f[].
.RS
.RE
.TP
.B -o, --output=\f[I]<outfile>\f[]
Put the completed mp4 into \f[C]\\<outfile>\f[].
.RS
.RE
.TP
.B --keep-temp-files
Keep all temporary files created while converting.
.RS
.RE
.TP
.B -n, --dry-run
Don\[aq]t run any commands, but print them in a shellquoted format that
can be safely copy-pasted by the user.
.RS
.RE
.TP
.B --stop-before-extract-video
Exit before extracting video from \f[C]\\<mkvfile>\f[].
.RS
.RE
.TP
.B --stop-before-correct-profile
Exit before correcting profile of raw H.264 stream.
.RS
.RE
.TP
.B --stop-before-extract-audio
Exit before extracting audio from \f[C]\\<mkvfile>\f[].
.RS
.RE
.TP
.B --stop-before-convert-audio
Exit before converting audio previously extracted.
This will stop even if the audio does not need to be converted.
.RS
.RE
.TP
.B --stop-before-video-mp4
Exit before adding the extracted video to the mp4 container.
.RS
.RE
.TP
.B --stop-before-hinting-mp4
Exit before hinting the mp4 file with the video track.
.RS
.RE
.TP
.B --stop-before-audio-mp4
Exit before adding the extracted (and possibly converted) audio to the
mp4 container.
.RS
.RE
.TP
.B \f[C]\\<mkvfile>\f[]
The Matroska (.mkv) file you wish to convert.
.RS
.RE
.TP
.B --correct-profile-only
Only correct the profile
.RE
.PP
<rawh264file>
.RS 4
The raw H\&.264 stream file that will have its profile corrected for use on the PS3\&.
.RE
.SH "EXIT STATUS"
.sp
0 on success and non\-zero on failure\&.
.SH "AUTHOR"
.sp
Gavin Beatty <gavinbeatty@gmail\&.com>
.SH "RESOURCES"
.sp
Website: http://code\&.google\&.com/p/mkvtomp4/
.SH "REPORTING BUGS"
.sp
Please report all bugs and wishes to <gavinbeatty@gmail\&.com>
.SH "COPYING"
.sp
mkvtomp4 Copyright (C) 2010 Gavin Beatty, <gavinbeatty@gmail\&.com>
.sp
Free use of this software is granted under the terms of the GNU General Public License version 3, or at your option, any later version\&. (GPLv3+)
.RS
.RE
.TP
.B \f[C]\\<rawh264file>\f[]
The raw H.264 stream file that will have its profile corrected for use
on the PS3.
.RS
.RE
.SH AUTHOR
.PP
Gavin Beatty <[email protected]>
.SH RESOURCES
.PP
Website: <http://code.google.com/p/mkvtomp4/>
.SH REPORTING BUGS
.PP
Please report all bugs and wishes to <[email protected]>
.SH COPYING
.PP
mkvtomp4 Copyright (c) 2012 Gavin Beatty, <[email protected]>
.PP
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:
.PP
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
.PP
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.
.SH AUTHORS
Gavin Beatty.
Loading

0 comments on commit 900a94c

Please sign in to comment.