Log in

View Full Version : h264enc for Linux


Pages : 1 2 3 4 5 6 7 8 9 10 11 [12] 13 14 15

watsonalgas
9th May 2011, 13:05
Yeah, you're right. So I just have to use -nosound to fix the problem. I use AC3 because I like a copy of the audio stream, not an encode.

It's weird that mencoder recently broke that, it seems like a big issue for encoding anyway.

POSSIBLE FIX: I know this isn't a problem with h264enc, but if you're interested a fix could be just encoding (or dumping) all audio seperately instead of during the encode. That solved my problems with AC3. So instead of dumping and encoding the audio in the same command as the video encode (as is usually done), make it -nosound and do the main audio like secondary audio streams are done.

yak_vi
12th May 2011, 00:59
Hi, thanks for sharing this utility! i have a VPS with Centos 5, all ok but when start to encode say this (all for command line i dont have video card), the error is:
[root@213671 html]# h264enc -2p -p fast

+=============================================================+
|<<<<<<< h264enc - the interactive shell script ripper >>>>>>>|
|-------------------------------------------------------------|
|<<<<<< version: 9.3.6 - (C) 2006-2011, Grozdan Nikolov >>>>>>|
+=============================================================+


Select the Input type [file/dir/dvd/vcd]: file
Provide the Input Video File: SAMPLE.VOB
Provide a name for the Output File [default is H264-23961]: sample

Note that you are running out of disk space in
the destination output directory and/or in the
configuration directory of h264enc!

This could be a problem if you want to convert
the final encode to MKV, OGM, TS or to the MP4
container. It is recommended to free up some disk
space or provide a different destination output
directory before continuing with the encoding
process if you intend to do some of the above
tasks!

Space left over in '/root': 2592 MiB
Space left over in '/root/.h264enc/job23961': 2592 MiB

#### Press 'Enter' to continue, CTRL+C to exit ####

Scan for multiple video streams? [y/N]: n
Would you like to use Pre/Postprocessing video filters? [y/N]: n
Would you like to Crop the Video file? [y/N]: n
Would you like to include/rip a Subtitle? [y/N]: n

-> Detecting FPS value...
-> Detected 25.000 FPS
-> Number of frames: 1722

Would you like to set/force the Output Frame Rate (FPS)? [y/N]: n
Would you like to do Frame Rate Conversion? [y/N]: n

-> Detecting original resolution...
-> Original resolution: 720x576

-> Detected Aspect Ratio (AR): 1.7778:1
-> Storage Aspect Ratio (SAR): 1.2500:1
-> Pixel Aspect Ratio (PAR): 1.4222:1
-> Total pixels: 414720

Specify the desired Resolution [default is 720x576]: 720x576
Specify the Expand filter parameters [press 'Enter' to skip]:
Would you like to set/force the input Video Aspect Ratio? [y/N]:

+=============================+
| H.264 Encoder Configuration |
+=============================+

Specify the desired Video Bitrate in kbps [default is 1000]:

-> Bits Per Pixel value: 0.096 bpp
-> Bits Per Block value: 24.691 bpb
-> Using "x264 fast" preset

+=====================+
| Audio Configuration |
+=====================+

Scan for multiple Audio streams? [y/N]: n

Available Audio Codecs
~~~~~~~~~~~~~~~~~~~~~~
MP3 -----> Container support: AVI, MKV, MP4, OGM, TS
AC3 -----> Container support: AVI, MKV, MP4, OGM, TS
AAC -----> Container support: MKV, MP4, TS
AAC+ ----> Container support: MP4, MKV
neroAAC -> Container support: MP4, MKV
VORBIS --> Container support: MP4, MKV, OGM
FLAC ----> Container support: MKV
PCM -----> Container support: AVI, MKV, OGM
COPY ----> Container support: Depends on audio codec
NOSOUND -> Container support: AVI, MKV, MP4, OGM, TS

Track 1: Select the Audio Codec [default is AAC]: AAC
Track 1: Specify the AAC encoding mode [ABR/VBR - default is ABR]: VBR
Track 1: Specify the AAC Quality value [10-500 - default is 150]: 96
Track 1: Enable AAC Temporal Noise Shaping? [y/N]: n
Track 1: Would you like to decode/output more than 2 Audio Channels? [y/N]: n
Track 1: Would you like to use Audio filters? [y/N]: n

+=============================+
| Miscellaneous Configuration |
+=============================+

Would you like to inspect the MEncoder options? [y/N]: n
Would you like to encode a Sample? [y/N]: n
Would you like to save the MEncoder options to a file? [y/N]: n
Would you like to convert the final encode from AVI to MKV? [y/N]: y
Specify the Release Year of the content [press 'Enter' to skip]:
Specify a Genre for the content [press 'Enter' to skip]:
Provide a Cover file in jpeg/png format [press 'Enter' to skip]:
Would you like to convert the final encode from AVI to MP4? [y/N]: y
Specify the Release Year of the content [press 'Enter' to skip]:
Specify a Genre for the content [press 'Enter' to skip]:
Provide a Cover file in jpeg/png format [press 'Enter' to skip]:
Hint the MP4 file for RTP/RTSP streaming sessions? [y/N]: n
Would you like to convert the final encode from AVI to TS? [y/N]: n

-> Starting to encode the Video file in 2-pass mode
-> Using "x264 fast" preset
-> Using '/dev/null' as output for the first pass
-> Using '/root/sample.avi' as output file for the second pass

Starting to encode in: 5 4 3 2 1
MEncoder SVN-r31628-4.1.2 (C) 2000-2010 MPlayer Team
Option x264encopts: turbo option is deprecated; use slow_firstpass to disable turbo
success: format: 0 data: 0x0 - 0x4bae000
MPEG-PS file format detected.
VIDEO: MPEG2 720x576 (aspect 3) 25.000 fps 9608.0 kbps (1201.0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x576 fps:25.000 ftime:=0.0400
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->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
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: none!
x264_encoder_open failed.
FATAL: Cannot initialize video driver.

Exiting...
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()

FATAL: Cannot initialize video driver.

Always say same error!

Is possible encode with your utility in linux only in console?

Thanks!

microchip8
15th May 2011, 14:36
@yak_vi

I'm not sure what is causing this. Try updating your mencoder/mplayer. Also your x264 looks like it can't detect any CPU capabilities. Looks like broken to me

yes it is possible to encode on linux in console only. I do it all the time

microchip8
15th May 2011, 14:37
ChangeLog for version 9.3.7
* Removed the ssim and psnr options from the presets. Should only be used for benchmarking

yak_vi
8th July 2011, 20:42
froggy1 is possible in the script modify to add subtitles to video? Thanks!

microchip8
8th July 2011, 21:45
@yak_vi

you can already do that

microchip8
23rd July 2011, 10:02
ChangeLog for version 9.3.8
* Update the mq, nq, hq, vhq, ehq, uhq and ihq presets. Increase subme by 1. For the ihq preset, this means that
it uses subme 11 now which requires latest x264 from git

microchip8
8th August 2011, 18:31
ChangeLog for version 9.3.9
* Bugfix: selecting the x264 internal denoiser does nothing due to missing $nr variable in the MEncoder options

microchip8
20th August 2011, 15:06
ChangeLog for version 9.4.0
* Disable mbtree in multipass mode to prevent segfaulting MEncoder due to differences in frames amount in
the passlog file. Disabling mbtree reduces quality but saves us a crash in MEncoder
* Notify the user that the script does not support AAC in AVI anymore. Also exit if user has not selected any of
the other supported containers

microchip8
10th October 2011, 20:41
ChangeLog for version 9.4.1
* Introduced two new variables in the config file, DEFAULT_VID_BITRATE and DEFAULT_AUD_CODEC.
The first one sets the default video bitrate or CRF/QP value while the second one can be used to set a
default audio codec. This change updates the config file to version 20
* Fixed a typo in man page

lib3rty1
28th November 2011, 21:11
I have ubununtu 11.10 server edition.

When I am runing h264enc I got


Checking for utility 'bc'... FAILED!


I have restartec cfg file but still I got that issue.
any idea how to fix it ?

microchip8
28th November 2011, 21:14
did you reset the config file with h264enc -r ?

if that still doesn't work, then open the config and add the path to bc manually. The config is in $HOME/.h264enc/config

lib3rty1
28th November 2011, 21:26
yes I did

where I can find that bc ?

microchip8
28th November 2011, 21:29
If you have installed bc, then type "which bc" in a terminal (no quotes). Then add the line in the BC variable of the config file

lib3rty1
28th November 2011, 21:34
ok got it working :D
great thx :)

love ya and your work :)

ok, last question, where to put nero acc codes to run it under your scrip ?

Goga777
3rd December 2011, 17:03
why h264enc didn't finish succesfully audio encoding ?


h264enc -crf -p fast

+=============================================================+
|<<<<<<< h264enc - the interactive shell script ripper >>>>>>>|
|-------------------------------------------------------------|
|<<<<<< version: 9.4.1 - (C) 2006-2011, Grozdan Nikolov >>>>>>|
+=============================================================+


Select the Input type [file/dir/dvd/vcd]: dir
Provide one Input Video File from the directory: dvgrab-2011.11.29_15-12-34.dv
Where to store the encodings? [default is /root/h264enc_21787]:
Would you like to use Pre/Postprocessing video filters? [y/N]:
Would you like to Crop the Video files? [y/N]:
Would you like to include/rip a Subtitle? [y/N]:

-> Detecting FPS value...
-> Detected 25.000 FPS
-> Number of frames: 148

Would you like to set/force the Output Frame Rate (FPS)? [y/N]:
Would you like to do Frame Rate Conversion? [y/N]:

-> Detecting original resolution...
-> Original resolution: 720x576

-> Detected Aspect Ratio (AR): 1.7778:1
-> Storage Aspect Ratio (SAR): 1.2500:1
-> Pixel Aspect Ratio (PAR): 1.4222:1
-> Total pixels: 414720

Specify the desired Resolution [default is 720x576]:
Specify the Expand filter parameters [press 'Enter' to skip]:
Would you like to set/force the input Video Aspect Ratio? [y/N]:

+=============================+
| H.264 Encoder Configuration |
+=============================+

Specify the desired CRF value [0-51.0 - default is 20.0]:

-> Using "x264 fast" preset

+=====================+
| Audio Configuration |
+=====================+


Available Audio Codecs
~~~~~~~~~~~~~~~~~~~~~~
MP3 -----> Container support: AVI, MKV, MP4, OGM, TS
AC3 -----> Container support: AVI, MKV, MP4, OGM, TS
AAC -----> Container support: MKV, MP4, TS
AAC+ ----> Container support: MP4, MKV
neroAAC -> Container support: MP4, MKV
VORBIS --> Container support: MP4, MKV, OGM
FLAC ----> Container support: MKV
PCM -----> Container support: AVI, MKV, OGM
COPY ----> Container support: Depends on audio codec
NOSOUND -> Container support: AVI, MKV, MP4, OGM, TS

Track 1: Select the Audio Codec [default is AAC]: neroAAC
Track 1: Which AAC Profile to use? [LC/HE/HEv2 - default is LC]:
Track 1: Specify the AAC Encoding Mode [ABR/CBR/VBR - default is ABR]:
Track 1: Specify the AAC Average Bitrate in kbps [default is 96]:
Track 1: Use 2-pass AAC encoding instead of 1-pass? [y/N]:
Track 1: Would you like to decode/output more than 2 Audio Channels? [y/N]:
Track 1: Would you like to use Audio filters? [y/N]:

+=============================+
| Miscellaneous Configuration |
+=============================+

Would you like to convert the final encode from AVI to MKV? [y/N]: y
Would you like to convert the final encode from AVI to MP4? [y/N]:
Delete the AVI file after remuxing? [y/N]: y

-> Starting to batch encode Video files in '.'
-> Using "x264 fast" preset
-> Using '/root/h264enc_21787' as output directory for all Video files
-> Using constant rate factor mode for all Video files
-> Batch file located in '/root/.h264enc/batch21787'

Starting to encode in: 5 4 3 2 1

-> Processing file './dvgrab-2011.11.29_15-12-34.dv'

MPlayer SVN-r34245 (C) 2000-2010 MPlayer Team
success: format: 0 data: 0x0 - 0x1453200
libavformat file format detected.
[dv @ 0x89e7da0]Estimating duration from bitrate, this may be inaccurate
[lavf] stream 0: video (dvvideo), -vid 0
[lavf] stream 1: audio (pcm_s16le), -aid 0
VIDEO: [dvsd] 720x576 0bpp 25.000 fps 28800.0 kbps (3515.6 kbyte/s)
[V] filefmt:35 fourcc:0x64737664 size:720x576 fps:25.000 ftime:=0.0400
==========================================================================
Opening audio decoder: [pcm] Uncompressed PCM audio decoder
AUDIO: 48000 Hz, 2 ch, s16le, 1536.0 kbit/100.00% (ratio: 192000->192000)
Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffdv] vfm: ffmpeg (FFmpeg DV)
==========================================================================
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x89d8d60]using unscaled yuv420p -> yuv420p special converter
x264 [info]: using SAR=64/45
x264 [info]: using cpu capabilities: MMX2 SSE2 SSE3 Cache64
x264 [info]: profile High, level 3.0
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
Pos: 1.4s 36f (34%) 0.00fps Trem: 0min 0mb A-V:0.049 [0:1536]
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.080s.
Writing header...
ODML: vprp aspect is 16:9.
Setting audio delay to 0.080s.
Pos: 5.9s 148f (100%) 6.36fps Trem: 0min 5mb A-V:0.041 [5640:1535]
File not found: 'n'
Failed to open n.
Cannot open file/device.

Exiting...
*************************************************************
* *
* Nero AAC Encoder *
* Copyright 2009 Nero AG *
* All Rights Reserved Worldwide *
* *
* Package build date: Feb 18 2010 *
* Package version: 1.5.4.0 *
* *
* See -help for a complete list of available parameters. *
* *
*************************************************************

mplayer: could not connect to socket
mplayer: No such file or directory
Processed 4 seconds...



cat batch21787
#!/bin/bash
# Automatically generated batch file by h264enc 9.4.1 on Сбт Дек 3 19:57:55 SAMT 2011

################### START OF COMMANDS ###################

cd "."
test -d "/root/h264enc_21787" || mkdir -p "/root/h264enc_21787"

for i in *; do

if [ -f "$i" ]; then

test -d "/root/.h264enc/job21787" || mkdir -p "/root/.h264enc/job21787"

echo
echo -e "\e[1;32m-> Processing file './$i'\e[0;39;49m"
echo
sleep 3

nice -n 10 /usr/bin/mencoder "$i" -o "/root/h264enc_21787/${i%.*}.avi" -nosub -vf softskip,harddup -oac pcm -ovc x264 -x264encopts crf=20:nointerlaced:preset=fast:keyint=250:keyint_min=25:force_cfr n

test -p "/root/.h264enc/job21787/audio.wav" || mkfifo "/root/.h264enc/job21787/audio.wav"
/usr/local/bin/neroAacEnc -ignorelength -br 96000 -lc -if "/root/.h264enc/job21787/audio.wav" -of "/root/.h264enc/job21787/audio.aac" &
/usr/bin/mplayer "/root/h264enc_21787/${i%.*}.avi" -noconfig all -loop 1 -really-quiet -vc null -vo null -nocache -ao pcm:fast:file="/root/.h264enc/job21787/audio.wav"
sleep 2

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE Tags SYSTEM \"matroskatags.dtd\">

<Tags>
<Tag>
<Simple>
<Name>Source</Name>
<String>Video file</String>
</Simple>
<Simple>
<Name>Title</Name>
<String>${i%.*}</String>
</Simple>
<Simple>
<Name>Video Filters</Name>
<String>softskip,harddup</String>
</Simple>
<Simple>
<Name>Audio Codec (Track 1)</Name>
<String>LC-AAC Stereo</String>
</Simple>
<Simple>
<Name>Encoder</Name>
<String>MPlayer SVN-r34245 (C) 2000-2010 MPlayer Team</String>
</Simple>
<Simple>
<Name>x264 parameters</Name>
<String>crf=20:nointerlaced:preset=fast:keyint=250:keyint_min=25:force_cfrn</String>
</Simple>
<Simple>
<Name>x264 version</Name>
<String>0.104.1677</String>
</Simple>
<Simple>
<Name>mkvmerge version</Name>
<String>5.1.0</String>
</Simple>
<Simple>
<Name>h264enc parameters</Name>
<String>h264enc -crf -p fast</String>
</Simple>
<Simple>
<Name>Comment</Name>
<String>Tagged by h264enc 9.4.1 on 2011/12/03</String>
</Simple>
</Tag>
</Tags>" > "/root/.h264enc/job21787/mkvtags.xml"
test -e "/root/h264enc_21787/${i%.*}.mkv" && mv -f "/root/h264enc_21787/${i%.*}.mkv" "/root/h264enc_21787/${i%.*}.mkv.old"
/usr/bin/mkvmerge --global-tags "/root/.h264enc/job21787/mkvtags.xml" -A --title "${i%.*}" --track-name 0:"${i%.*}" "/root/h264enc_21787/${i%.*}.avi" --track-name 1:"LC-AAC Stereo" --no-chapters "/root/.h264enc/job21787/audio.aac" -o "/root/h264enc_21787/${i%.*}.mkv"
sleep 2

rm -f "/root/h264enc_21787/${i%.*}.avi"
rm -rf "/root/.h264enc/job21787"

fi

done

#################### END OF COMMANDS ####################




ffmpeg -i dvgrab-2011.11.29_15-12-34.dv
FFmpeg version git-6a7e074, Copyright (c) 2000-2011 the FFmpeg developers
built on Mar 8 2011 10:38:12 with gcc 4.5.2
configuration: --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-libvpx --enable-librtmp --extra-libs=-lgcrypt --disable-altivec --disable-armv5te --disable-armv6 --disable-vis
libavutil 50. 39. 0 / 50. 39. 0
libavcodec 52.113. 2 / 52.113. 2
libavformat 52.102. 0 / 52.102. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1. 76. 0 / 1. 76. 0
libswscale 0. 12. 0 / 0. 12. 0
libpostproc 51. 2. 0 / 51. 2. 0
[dv @ 0x8468dc0] Estimating duration from bitrate, this may be inaccurate
Input #0, dv, from 'dvgrab-2011.11.29_15-12-34.dv':
Duration: 00:00:05.92, start: 0.000000, bitrate: 28800 kb/s
Stream #0.0: Video: dvvideo, yuv420p, 720x576, 28800 kb/s, PAR 64:45 DAR 16:9, 25 tbr, 25 tbn, 25 tbc
Stream #0.1: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
At least one output file must be specified

microchip8
3rd December 2011, 17:51
ok got it working :D
great thx :)

love ya and your work :)

ok, last question, where to put nero acc codes to run it under your scrip ?

you can put them in /usr/local/bin

make sure you run h264enc -r after that

microchip8
3rd December 2011, 18:03
@Goga777

you have somehow introduced an illegal character. There's mentioning of an 'n' in the settings and the mkv global tags. I don't know how you introduced that character since I can't replicate here and I followed the exact steps you took

Goga777
4th December 2011, 14:44
yes, with terminal emulator as konsole, gnome-terminal and Yakuake I have the problem with additional 'n'

but with native terminal (ctrl-alt-f1) I don't have the problems with this issue

andara
14th December 2011, 10:56
I used h264enc about a year ago and was really amazed. It just worked out of the box and produced great results. Since then I've updated from Fedora 14 to Fedora 16 and when I tried to use h264enc on my current system, it unfortunately didn't work at all.
First mencoder crashed all the time and I couldn't get anything encoded. Obviously the h264enc version and the mencoder version provided for Fedora 16 on http://rpmfusion.org/ are not compatible. I downloaded the 9.4.1 release of h264enc from sourceforge and manually compiled a current svn version of mencoder. This fixed most of the problems and h264enc almost works as expected now. The only remaining --- but unfortunately huge issue --- is a completely messed up a/v sync.
I get lots of warnings about duplicate frames while encoding and the audio stream is several seconds off compared to the video stream in the resulting file.
If I manually add "-mc 0 -noskip" to all mencoder calls in the created batchfile I don't see any of the duplicate frames warnings and a/v sync seems ok.

Am I the only one seeing this kind of a/v sync problems with the default settings of h264enc, or is this a common problem (with a known fix)?

By the way: I use the h264enc options "-crf -p ehq" to convert a PAL DVD and "COPY" for the audio stream which is an AC-3 stream.

nevertheless: thanks for this great little helper tool!

microchip8
14th December 2011, 11:39
Unfortunately, this can happen at any time. MEncoder is unmaintained and each time it works, we're a bit lucky. I've also had my share of problems with it and am currently using a somewhat older version to bypass some issues in current ones. I don't think there's much I can do about your problem. My only two questions are: 1) does this also happen with other audio codecs? and 2) does this always happen, regardless of the DVD you use?

andara
19th December 2011, 03:06
sorry for the late response
I'm new to the forum and messed up my mail notification settings...

I see the problem with lots of different DVDs

I just checked one DVD with different audio codecs and the problem seems to be restricted to COPY. AAC, VORBIS and even reencoding to AC3 seems to work fine, but when selecting COPY for the AC3 input I get lots of duplicate frames and a/v sync issues in the output file.

Adding "-mc 0 -noskip" to the mencoder calls fixes the a/v issues and I didn't find other artifacts in the output files, but I didn't run exhaustive tests and I'm definitely not an mencoder expert, so I'm not sure if it's a good idea to add it to the COPY preset.

microchip8
19th December 2011, 11:35
yeah, this definitely sounds like a mencoder issue. Unfortunately i can't add -mc 0 -noskip as default for copy as it couldn mess up things in other mencoder versions where this doesn't happen so i think you'll just need to keep adding these options

andara
19th December 2011, 13:44
Thanks for the prompt reply!

Do you think I should report an mencoder bug for this issue?

I know you have considered ffmpeg as alternative to mencoder

Yes, I know about the state of mencoder :)

No, I don't plan in supporting ffmpeg within h264enc as it will require a major rewrite in a lot of parts in the script... Maybe I'll write a new script at some point which uses ffmpeg instead. My main problem with ffmpeg is that it can't directly read from DVDs while mencoder easily can

have you thought about using VLC? Should be no problem to read DVDs, ISO images or VIDEO_TS folders with VLC and there are quite some command line switches for tanscoding.
There might be less compatibility issues which might lead to less maintenance work on your side ;)

microchip8
19th December 2011, 13:58
Even if you report it, I don't think anyone will fix the issue as no one works on mencoder anymore. The main dev of mplayer doesn't care much for mencoder and it's the same with the other handful devs. If you're up to it, report, but don't expect this to get fixed (anytime soon, if at all). I can add an option to the script so the user can pass "additional options" to mencoder... We'll see :)

No, I haven't considered VLC. It's not really a flexible encoding tool

microchip8
19th December 2011, 15:03
btw, I just tried using COPY on a few DVDs. It all works fine on my side. No duplicate or frame skipping issues. Though like I mentioned, I use a somewhat older SVN version of MEncoder - MEncoder SVN-r32792

andara
19th December 2011, 15:28
I use MEncoder SVN-r34401-4.6.2, so it's probably a recently introduced bug...

microchip8
19th December 2011, 15:38
you're right. I just compiled r34450 and I also get duplicates while doing COPY. Definitely something wrong with mencoder

andara
19th December 2011, 15:44
I found a related MEncoder bug and added a reference to this thread
http://bugzilla.mplayerhq.hu/show_bug.cgi?id=1958

Rasi
21st December 2011, 16:47
As much as i love mplayer - mencoder really needs to die. ffmpeg may have its own flaws, but in general its much better suited for encoding nowadays.

microchip8
21st December 2011, 20:58
As much as i love mplayer - mencoder really needs to die. ffmpeg may have its own flaws, but in general its much better suited for encoding nowadays.

And as long as mencoder exists and works "fairly OK", I will keep maintaining h264enc and my other scripts :)

hlmasterchief93
25th December 2011, 09:37
hi, just switch to linux/ubuntu
so i am looking for encoder
whats about other options, FFmpeg ?

microchip8
27th December 2011, 19:31
hi, just switch to linux/ubuntu
so i am looking for encoder
whats about other options, FFmpeg ?

ffmpeg will not be supported by h264enc.

microchip8
1st January 2012, 16:58
ChangeLog for version 9.4.2

* Use a separate variable in config file for setting the default CRF or QP value (DEFAULT_VID_CRFQP). This bumps the config file version to 21
* Renamed the DEFOUTPUT, DEFPATH and DEFBATCHDIR variables to DEFAULT_OUTPUT, DEFAULT_PATH and DEFAULT_BATCHDIR
* Be slightly more portable by using #!/usr/bin/env bash instead of #!/bin/bash shebang
* Replaced some if conditionals in the -sc option by using 'test' directly
* Added an option for passing additional MEncoder parameters. Useful for when the user wants to use something like -mc 0 -noskip, for example
* Added support for encoding to DTS audio through the dcaenc encoder which can be found at http://aepatrakov.narod.ru/dcaenc/
* Minor changes to the video_delogo_func() function. Use $sourcetype, $device, $vid and $MPLAYEROPTS variables. Also use -nosound in MPlayer
* Improved the mkvtags file. Escape special characters like &, <, > and " in the Title field

microchip8
3rd January 2012, 14:56
ChangeLog for version 9.4.3
* Use -vc dummy in MPlayer in the audio code. Seems to work better on some files

Henrikx
15th January 2012, 13:47
Question from the German Debianforum : With Version 9.3.2 is not (more?)possible to multiplex (mux) AAC/AC3 in Avi. Is that correct?
https://debianforum.de/forum/viewtopic.php?f=25&t=133846

microchip8
15th January 2012, 13:51
AAC in AVI is no longer supported. AC3 in AVI however is still supported

If you want to use AAC, you must select at least one of the other supported containers like MP4/MKV/TS

Henrikx
15th January 2012, 18:40
Thx!!!

microchip8
21st February 2012, 20:08
ChangeLog for version 9.4.4
* Only 'sed' mbtree for multi-pass mode
* Don't append "- chapter [id]" to output file when encoding only specific chapters

Goga777
13th March 2012, 00:45
I tried to encode video for my mobile phone Samsung S5230
Normally the phone support AAC, AAC+, mp3 and h264 in mp4 conainer. Resolution should be 320x240
Nevertheless I couldn't obtain the video which will bw play on my phone.
I have the error - unsupported media format or bitrate over

my batchfile is here http://paste.org.ru/?qj93dc


mplayer can play this file, but Samsung couldn't


mplayer H264-29612.mp4
Failed to read /etc/mplayer/mplayer.conf.local: No such file or directory
Warning unknown option include at line 171
MPlayer SVN-r34728 (C) 2000-2010 MPlayer Team
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing H264-29612.mp4.
libavformat version 54.1.100 (internal)
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (mp3), -aid 0, -alang und
VIDEO: [H264] 320x240 24bpp 25.000 fps 981.2 kbps (119.8 kbyte/s)
Clip info:
major_brand: isom
minor_version: 1
compatible_brands: isomavc1
creation_time: 2012-03-12 23:13:16
title: H264-29612
comment: Tagged by h264enc 9.4.4 on Втр Мар 13 03:13:16 SAMT 2012
Load subtitles in ./
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 54.3.100 (internal)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
==========================================================================
Requested audio codec family [mpg123] (afm=mpg123) not available.
Enable it at compilation.
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, floatle, 131.0 kbit/4.64% (ratio: 16379->352800)
Selected audio codec: [ffmp3float] afm: ffmpeg (FFmpeg MPEG layer-3 audio)
==========================================================================
AO: [alsa] 48000Hz 2ch floatle (4 bytes per sample)
Starting playback...
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is 1.77:1 - prescaling to correct movie aspect.
VO: [xv] 320x240 => 426x240 Planar YV12
A: 1.1 V: 1.0 A-V: 0.171 ct: -0.036 0/ 0 217% 327% 9.9% 4 0

Exiting... (Quit)


what will be your recommendation to obtain compatible videofile with my phone?

microchip8
13th March 2012, 09:47
I really don't know what your phones supports but I'd suggest using one of the iPhone presets and see if it works

Goga777
20th March 2012, 20:09
thank you for the advice - the Apple iPod Classic preset helped me

Soapm
24th March 2012, 19:10
I am having a lot of trouble using this program. I am a movie novice but some of the questions are kind of confusing.

Like this one for example;

Specify the desired Resolution [default is ??]:

No matter what I put I get an error saying it isn't dividable by 16. Where or how would I find the correct response?

Then after filling out that entire script this is what I get for an output. What's up with this?

Starting to encode in: 5 4 3 2 1
MPlayer SVN-r31918 (C) 2000-2010 MPlayer Team
The hostname option must be an integer: platoon
Struct dvd, field hostname parsing error: platoon
libdvdread: Encrypted DVD support unavailable.
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.IFO failed
libdvdnav:DVDOpenFileUDF:UDFFindFile /VIDEO_TS/VIDEO_TS.BUP failed
libdvdread: Can't open file VIDEO_TS.BU.
Can't open VMG info!
No stream found to handle url dvd://platoon
Cannot open file/device.

Exiting...
-> MEncoder has exited with a non-zero value!
-> Exiting in function: mencoder_exit()

Lastly, is there a secret to making the scan work? I push 7 for all and get this question;

Specify the DVD title [1-/all]

What in the world is that asking? and what do you put for a response. I tried 1 then I tried all but neither seems to give me an output.

microchip8
25th March 2012, 11:49
@Soapm

You're dealing with an encrypted DVD but your mplayer doesn't have that support
libdvdread: Encrypted DVD support unavailable.

I suspect that's why you get these problems. Compile mplayer yourself or get a package with encrypted support from somewhere

Goga777
25th March 2012, 16:07
seems there is problem withe transcoding aac with faac


-> Track 1: Encoding audio with 'faac' to LC-AAC, please wait...
-> Track 1: This can take a while...


the process is frozen and have to stop it with ctrl-с in 10 minutes after this message
If I will use neroAAC than no problem


h264enc -1p -p ipc


+=============================================================+
|<<<<<<< h264enc - the interactive shell script ripper >>>>>>>|
|-------------------------------------------------------------|
|<<<<<< version: 9.4.4 - (C) 2006-2012, Grozdan Nikolov >>>>>>|
+=============================================================+


Select the Input type [file/dir/dvd/vcd]: file
Provide the Input Video File: Hanna.mp4
Provide a name for the Output File [default is H264-6680]: Hanna.mp4

-> Renaming existing file to 'Hanna.avi.1.old'

Scan for multiple video streams? [y/N]:
Would you like to use Pre/Postprocessing video filters? [y/N]:
Would you like to Crop the Video file? [y/N]:
Would you like to include/rip a Subtitle? [y/N]:

-> Detecting FPS value...
-> Detected 29.750 FPS
-> Number of frames: 5721

Would you like to set/force the Output Frame Rate (FPS)? [y/N]:

-> Detecting original resolution...
-> Original resolution: 480x222
-> Valid iPod Classic resolutions: 320x240

-> Detected Aspect Ratio (AR): 2.1622:1
-> Storage Aspect Ratio (SAR): 2.1621:1
-> Pixel Aspect Ratio (PAR): 1.0000:1
-> Total pixels: 106560

Specify the desired Resolution [default is 480x222]: 320x240

Available Software Scalers
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 --> Fast Bilinear
1 --> Bilinear
2 --> Bicubic
3 --> Experimental
4 --> Nearest Neighbor/Point
5 --> Area Averaging
6 --> Luma Bicubic/Chroma Bilinear
7 --> Gaussian
8 --> Sinc
9 --> Lanczos
10 -> Natural Bicubic Spline

-> Storage Aspect Ratio (SAR): 1.3333:1
-> Pixel Aspect Ratio (PAR): 1.6216:1
-> Total pixels: 76800

Select a Software Scaler [default is 10]:
Specify the Display size/aspect [press 'Enter' to skip]:
Specify the Expand filter parameters [press 'Enter' to skip]:
Would you like to set/force the input Video Aspect Ratio? [y/N]: y

-> Detecting video aspect ratio...
-> Detected: 2.1622

Specify the Aspect Ratio [4:3/16:9/1.3333/1.7778... - default is 2.1622]: 16:9

+=============================+
| H.264 Encoder Configuration |
+=============================+

Specify the desired Video Bitrate in kbps [default is 1000]:

-> Bits Per Pixel value: 0.437 bpp
-> Bits Per Block value: 112.044 bpb
-> Using "Apple iPod Classic" preset

+=====================+
| Audio Configuration |
+=====================+

Scan for multiple Audio streams? [y/N]:

Track 1: Select the Audio Codec [AAC/neroAAC/NOSOUND - default is AAC]: AAC
Track 1: Specify the AAC Average Bitrate [default is 128]:
Track 1: Enable AAC Temporal Noise Shaping? [y/N]:
Track 1: Would you like to use Audio filters? [y/N]:

+=============================+
| Miscellaneous Configuration |
+=============================+

Would you like to set a target file size? [y/N]:
Would you like to pass additional options to MEncoder? [y/N]:
Would you like to inspect the MEncoder options? [y/N]:
Would you like to encode a Sample? [y/N]:
Would you like to save the MEncoder options to a file? [y/N]:
Would you like to convert the final encode from AVI to MKV? [y/N]:
Would you like to convert the final encode from AVI to MP4? [y/N]: y
Specify the Release Year of the content [press 'Enter' to skip]:
Specify a Genre for the content [press 'Enter' to skip]:
Provide a Cover file in jpeg/png format [press 'Enter' to skip]:
Hint the MP4 file for RTP/RTSP streaming sessions? [y/N]:
Would you like to convert the final encode from AVI to TS? [y/N]:

-> Starting to encode the Video file in 1-pass mode
-> Using "Apple iPod Classic" preset
-> Using '/home/goga/Hanna.avi' as output file

Starting to encode in: 5 4 3 2 1
MPlayer SVN-r34809 (C) 2000-2012 MPlayer Team
success: format: 0 data: 0x0 - 0xc53c4c
libavformat version 54.2.100 (internal)
libavformat file format detected.
[lavf] stream 0: audio (aac), -aid 0, -alang und
[lavf] stream 1: video (h264), -vid 0
VIDEO: [H264] 480x222 24bpp 29.750 fps 414.5 kbps (50.6 kbyte/s)
[V] filefmt:44 fourcc:0x34363248 size:480x222 fps:29.750 ftime:=0.0336
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 54.10.100 (internal)
AUDIO: 44100 Hz, 2 ch, s16le, 120.5 kbit/8.54% (ratio: 15060->176400)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [scale w=320 h=240 interlaced=0]
Opening video filter: [softskip]
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
Unsupported PixelFormat 61
Unsupported PixelFormat 53
Unsupported PixelFormat 81
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
[swscaler @ 0x8b40c00]Bicubic spline scaler, from yuv420p to yuv420p using MMX2
x264 [warning]: max bitrate less than average bitrate, assuming CBR
x264 [info]: using SAR=213/160
x264 [warning]: VBV bitrate (1000) > level limit (768)
x264 [info]: using cpu capabilities: MMX2 SSE2 SSE3 Cache64
x264 [info]: profile Constrained Baseline, level 1.3
Pos: 1.4s 43f ( 1%) 0.00fps Trem: 0min 0mb A-V:0.056 [0:1536]
Writing header...
ODML: vprp aspect is 16384:9230.
Writing header...
ODML: vprp aspect is 16384:9230.
Pos: 192.3s 5722f (100%) 37.21fps Trem: 0min 57mb A-V:0.036 [963:1535]

Flushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:9230.

Video stream: 963.942 kbit/s (120492 B/s) size: 23175098 bytes 192.336 secs 5722 frames

Audio stream: 1536.000 kbit/s (191999 B/s) size: 36927492 bytes 192.331 secs
x264 [info]: frame I:81 Avg QP:15.37 size: 14053
x264 [info]: frame P:5641 Avg QP:17.95 size: 3907
x264 [info]: mb I I16..4: 7.0% 0.0% 93.0%
x264 [info]: mb P I16..4: 0.6% 0.0% 5.1% P16..4: 33.8% 35.3% 15.5% 0.0% 0.0% skip: 9.8%
x264 [info]: coded y,uvDC,uvAC intra: 89.4% 97.1% 89.7% inter: 46.5% 60.4% 17.1%
x264 [info]: i16 v,h,dc,p: 33% 42% 9% 17%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 13% 12% 4% 6% 9% 4% 8% 4%
x264 [info]: i8c dc,h,v,p: 35% 15% 39% 11%
x264 [info]: kb/s:963.94

-> Track 1: Encoding audio with 'faac' to LC-AAC, please wait...
-> Track 1: This can take a while...





lushing video frames.
Writing index...
Writing header...
ODML: vprp aspect is 16384:9230.

Video stream: 963.682 kbit/s (120460 B/s) size: 23168857 bytes 192.336 secs 5722 frames

Audio stream: 1536.000 kbit/s (191999 B/s) size: 36927492 bytes 192.331 secs
x264 [info]: frame I:81 Avg QP:15.35 size: 14077
x264 [info]: frame P:5641 Avg QP:17.95 size: 3905
x264 [info]: mb I I16..4: 7.0% 0.0% 93.0%
x264 [info]: mb P I16..4: 0.6% 0.0% 5.1% P16..4: 33.8% 35.3% 15.5% 0.0% 0.0% skip: 9.7%
x264 [info]: coded y,uvDC,uvAC intra: 89.4% 97.1% 89.8% inter: 46.5% 60.4% 17.0%
x264 [info]: i16 v,h,dc,p: 33% 41% 8% 17%
x264 [info]: i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 13% 12% 4% 6% 9% 4% 8% 4%
x264 [info]: i8c dc,h,v,p: 35% 15% 39% 11%
x264 [info]: kb/s:963.68

-> Track 1: Encoding audio with 'neroAacEnc' to LC-AAC, please wait...
-> Track 1: This can take a while...
-> Track 1: Done

-> Converting AVI file to the MP4 container, please wait...
-> Done

-> AVI file size: 57.458 MiB (/home/goga/Hanna.avi)
-> MP4 file size: 25.093 MiB (/home/goga/Hanna.mp4)

Delete the AVI file? [y/N]: y

-> Have a nice day ^_^

microchip8
25th March 2012, 19:45
works fine for me. Can you post your batchfile?

Also make sure your FAAC is compiled with MP4 container support (the -w option)

Soapm
25th March 2012, 20:48
@Soapm

You're dealing with an encrypted DVD but your mplayer doesn't have that support
libdvdread: Encrypted DVD support unavailable.

I suspect that's why you get these problems. Compile mplayer yourself or get a package with encrypted support from somewhere

I just had a chance to dig into it today and I didn't realize my DVD player wasn't mounting. I ended up changing the IDE cable and going cable select and now it seems to be working ok.

The good side is that I installed apt-get install libdvdcss-dev I believe that fixed encryption error. At least it looks that way at this point...

thanks!

Goga777
27th March 2012, 18:13
I think that's the point - MP4 support unavailable. I will use neroAAC

thank you for the tip


faac --help
Freeware Advanced Audio Coder
FAAC 1.28

Usage: faac [options] infiles ...
Options:
-q <quality> Set quantizer quality.
-b <bitrate> Set average bitrate to x kbps. (ABR, lower quality mode)
-c <freq> Set the bandwidth in Hz. (default=automatic)
-o X Set output file to X (only for one input file)
-r Use RAW AAC output file.
-P Raw PCM input mode (default 44100Hz 16bit stereo).
-R Raw PCM input rate.
-B Raw PCM input sample size (8, 16 (default), 24 or 32bits).
-C Raw PCM input channels.
-X Raw PCM swap input bytes
-I <C,LF> Input channel config, default is 3,4 (Center third, LF fourth)

MP4 specific options:
MP4 support unavailable.

Goga777
27th March 2012, 19:05
I'm wondering - why standard in Linux option "--help" doesn't work with h264enc ? only "-help" is working

microchip8
27th March 2012, 19:53
I'm wondering - why standard in Linux option "--help" doesn't work with h264enc ? only "-help" is working

it's to be consistent with the other options, which are all short ones like -v, -r, -iso, etc :)