Mencoder failing to initialize video driver - mp4

I am using the following Mencoder command as part of a perl script that burns subtitles for different MP4 videos.
mencoder -profile h264mp4 source_file.mp4 -subcp utf8 -sub subtitle_file.srt -o destination_file.mp4 >> /dev/null
This has been working for over a year without problems and it is now giving the following fatal error when run:
** MUXER_LAVF *****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
FATAL: Cannot initialize video driver.
ffmpeg version 0.7.15, Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 22 2013 07:18:58 with gcc 4.4.5
configuration: --enable-libdc1394 --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-libfreetype --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. 43. 0 / 50. 43. 0
libavcodec 52.123. 0 / 52.123. 0
libavformat 52.111. 0 / 52.111. 0
libavdevice 52. 5. 0 / 52. 5. 0
libavfilter 1. 80. 0 / 1. 80. 0
libswscale 0. 14. 1 / 0. 14. 1
libpostproc 51. 2. 0 / 51. 2. 0
This are the contents of the h264mp4 profile:
[h264mp4]
profile-desc="H.264 MP4"
vf=pullup,softskip,pp=fd,hqdn3d,harddup
lavdopts=threads=2
ovc=x264=yes
x264encopts=crf=22:subq=6:frameref=6:qcomp=0.8:8x8dct=yes:weight_b=yes:me=umh:partitions=p8 x8,i4x4:nodct_decimate=yes:trellis=1:direct_pred=auto:level_idc=30:nocabac=yes:threads=auto
oac=faac=yes
faacopts=br=128:raw=yes:mpeg=4:tns=yes:object=2
of=lavf=yes
lavfopts=format=mp4
sws=9
ofps=24000/1001
srate=48000
I get the same error on my Debian Squeeze and on Amazon's Bitnami servers.
Both were updated recently so my guess is that the new packages don't like either the command line or the profile parameters.

The solution was to remove vf=pullup from the h264mp4 profile.
I found this by trial and error, I will elaborate on the answer as soon as I investigate on why this causes the Fatal error.

I am using openSUSE 13.2 x64 and had the same problem and managed to solve it by installing all libav* libraries (like: libavcodec) and libx264 from packman repository.
The problem was that I was installing libav* libraries from different repositories (some from packman and some from others).

Related

Raspberry Pi 4 saving corrupt h264 files?

I've been able to record .h264 files without a problem, both using raspivid and through Python, but whatever I try, I can't convert them to a .mp4, .mkv or .avi file.
I've tried converting using MP4box (suggested in several places) and mkvmerge, but to no avail.
When I use MP4box (MP4box -add <source.h264> <dest.mp4>), I get :
AVC-H264 import - frame size 1920 x 1080 at 25.000 FPS
WARNING: NAL Unit type 0 not handled - adding5/100)
AVC Import results: 44 samples - Slices: 3 I 41 P 0 B - 0 SEI - 3 IDR
Saving video.mp4: 0.500 secs Interleaving
Then I try to play this file using VLC, it doesn't give an error, but shows garbled data.
To be clear, the camera works fine (shows perfect video using Python code and raspistill outputs a perfect jpg file). I tried a different camera as well.
An attempt with mkvmerge :
pi#raspberrypi:~/cam $ raspivid -o test.h264 -fps 30 -t 15000 -w 1920 -h 1080
pi#raspberrypi:~/cam $ mkvmerge --default-duration 0:30p -o video.mkv test.h264
mkvmerge v31.0.0 ('Dolores In A Shoestand') 32-bit
'test.h264': Using the demultiplexer for the format 'AVC/h.264'.
'test.h264' track 0: Using the output module for the format 'AVC/h.264 (unframed)'.
The file 'video.mkv' has been opened for writing.
Error: 'test.h264' track 0: mkvmerge encountered broken or unparsable data in this AVC/h.264 video track. Either your file is damaged (which mkvmerge cannot cope with yet) or this is a bug in mkvmerge itself. The error message was:
Success
pi#raspberrypi:~/cam $
This is on a Raspberry Pi 4.
A sample file can be found here : https://filebin.net/c40usz0crhgggadf
Created with : raspivid -t 30000 -w 640 -h 480 -fps 25 -b 1200000 -p 0,0,640,480 -o pivideo.h264
I'm going to respond to this myself. After doing an 'apt-get upgrade', the problem is gone.
If anyone wants to figure this out to find the root cause, this is what apt-get did :
The following packages will be upgraded:
bind9-host bluez-firmware firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek libbind9-161 libdns-export1104 libdns1104 libgs9 libgs9-common libisc-export1100 libisc1100 libisccc161
libisccfg163 liblwres161 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel raspberrypi-kernel-headers raspi-config rpd-plym-splash
The following packages will be DOWNGRADED:
python3-pgzero
27 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.

"cpanm PHP" fails

What should I change in order to install the module? php is 5.3.3 withyum install php-devel in place.
PHP.c: In function ‘PHP_set_php_input’:
PHP.c:818: warning: passing argument 2 of ‘Perl_sv_2pv_flags’ from incompatible pointer type
/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/proto.h:3931: note: expected ‘STRLEN * const’ but argument is of type ‘int *’
cc -c -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -Wall -O2 -DVERSION=\"0.15\" -DXS_VERSION=\"0.15\" -fPIC "-I/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE" array.c
In file included from /usr/include/php/main/php.h:33,
from /usr/include/php/sapi/embed/php_embed.h:23,
from PHP.h:14,
from array.c:9:
/usr/include/php/main/php_config.h:2417:1: warning: "_GNU_SOURCE" redefined
In file included from /home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/perl.h:28,
from PHP.h:9,
from array.c:9:
/home/mpapec/.plenv/versions/5.20.0/lib/perl5/5.20.0/x86_64-linux/CORE/config.h:1825:1: warning: this is the location of the previous definition
rm -f blib/arch/auto/PHP/PHP.so
cc -shared -O2 -L/usr/local/lib -fstack-protector PHP.o array.o -o blib/arch/auto/PHP/PHP.so \
\
chmod 755 blib/arch/auto/PHP/PHP.so
"/home/mpapec/.plenv/versions/5.20.0/bin/perl5.20.0" -MExtUtils::Command::MM -e 'cp_nonempty' -- PHP.bs blib/arch/auto/PHP/PHP.bs 644
Manifying 1 pod document
Running Mkbootstrap for PHP ()
chmod 644 "PHP.bs"
PERL_DL_NONLAZY=1 "/home/mpapec/.plenv/versions/5.20.0/bin/perl5.20.0" "-Iblib/lib" "-Iblib/arch" test.pl
1..79
not ok 1 - use_ok PHP
# Failed test 'use_ok PHP'
# at test.pl line 11.
not ok 2 - require PHP;
# Failed test 'require PHP;'
# at test.pl line 18.
# Tried to require 'PHP'.
# Error: Attempt to reload PHP.pm aborted.
# Compilation failed in require at (eval 6) line 2.
not ok 3 - eval
# Failed test 'eval'
# at test.pl line 49.
Module PHP failed to load at blib/lib/PHP.pm line 80.
Module PHP failed to load at blib/lib/PHP.pm line 80.
END failed--call queue aborted at test.pl line 50.
# Looks like you planned 79 tests but ran 3.
# Looks like you failed 3 tests of 3 run.
# Looks like your test exited with 22 just after 3.
make: *** [test_dynamic] Error 22
-> FAIL Installing PHP failed. See /home/mpapec/.cpanm/work/1440522239.12833/build.log for details. Retry with --force to force install it.
(
PHP is kind of fragile. It probably won't work out of the box with your system php installation, and may have trouble with 64-bit or multi-threaded versions of perl.
I have only ever gotten it to work on Linux. The latest version I have tried to use is 5.3.8 (back in 2013), though I remember things going smoothly from 5.2.x to 5.3.8.
I always build php from source, with this configuration:
./configure --enable-embed --with-zlib --with-openssl --with-mysql \
--with-libdir=lib/i386-linux-gnu
--enable-embed is absolutely required, as the pod mentions, to build a PHP interpreter with the SAPI extension, and which then allows perl to manipulate the PHP interpreter through XS code. The other extensions were for other requirements of my project; they may be optional, but I haven't experimented with building the PHP interpreter or the PHP module with any other configuration. The pod also says to never use the --with-apxs argument, which I was never tempted to do anyway.
The build process of the PHP module will look for and require a program called php-config. You may need to hack your $PATH, if only during the build process, so that the PHP module runs the correct php-config. After that the module will know where to look for the rest of your php installation.
I had fun working with this module for a while (writing a Catalyst and then a Mojolicious wrapper around WordPress), but it has fallen into disrepair and disrepute. Share whatever you learn trying to build it and we'll put it in the docs, making this module that much easier to use.

Cannot install Perl module due to missing cc1 compiler on Ubuntu 14.04

I am trying to install Moose using cpanm on Ubuntu 14.04, but I get an error saying:
Running Makefile.PL
Configuring Moose-2.1210 ... cc: error trying to exec 'cc1': execvp: No such file or directory
This distribution requires a working compiler at Makefile.PL line 52.
N/A
! Configure failed for Moose-2.1210. See /home/hakon/.cpanm/work/1407056127.30229/build.log for details.
I have installed gcc compiler version 4.8.2. :
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.8/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-19ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs --enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.8 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-i386 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-i386 --with-arch-directory=i386 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-targets=all --enable-multiarch --disable-werror --with-arch-32=i686 --with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1)
Here is more output (the whole output is available here):
$ cpanm -v Moose
cpanm (App::cpanminus) 1.7004 on perl 5.018002 built for i686-linux-gnu-thread-multi-64int
Work directory is /home/hakon/.cpanm/work/1407056507.30283
You have make /usr/bin/make
You have LWP 6.05
You have /bin/tar: tar (GNU tar) 1.27.1
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by John Gilmore and Jay Fenlason.
You have /usr/bin/unzip
Checking if you have ExtUtils::MakeMaker 6.31 ... Yes (6.66)
Checking if you have ExtUtils::Install 1.46 ... Yes (1.59)
Searching Moose on cpanmetadb ...
Unpacking Moose-2.1210.tar.gz
--> Working on Moose
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Moose-2.1210.tar.gz ... OK
Moose-2.1210/
Moose-2.1210/author/
Moose-2.1210/benchmarks/
Moose-2.1210/bin/
Moose-2.1210/Changes
Moose-2.1210/Changes.Class-MOP
Moose-2.1210/dist.ini
Moose-2.1210/doc/
Moose-2.1210/inc/
Moose-2.1210/lib/
Moose-2.1210/LICENSE
Moose-2.1210/Makefile.PL
Moose-2.1210/MANIFEST
Moose-2.1210/META.json
Moose-2.1210/META.yml
Moose-2.1210/mop.c
Moose-2.1210/mop.h
...
<cut>
...
Moose-2.1210/benchmarks/cmop/run_yml.pl
Moose-2.1210/benchmarks/cmop/lib/Bench/
Moose-2.1210/benchmarks/cmop/lib/MOP/
Moose-2.1210/benchmarks/cmop/lib/Plain/
Moose-2.1210/benchmarks/cmop/lib/Plain/Point.pm
Moose-2.1210/benchmarks/cmop/lib/Plain/Point3D.pm
Moose-2.1210/benchmarks/cmop/lib/MOP/Immutable/
Moose-2.1210/benchmarks/cmop/lib/MOP/Installed/
Moose-2.1210/benchmarks/cmop/lib/MOP/Point.pm
Moose-2.1210/benchmarks/cmop/lib/MOP/Point3D.pm
Moose-2.1210/benchmarks/cmop/lib/MOP/Installed/Point.pm
Moose-2.1210/benchmarks/cmop/lib/MOP/Installed/Point3D.pm
Moose-2.1210/benchmarks/cmop/lib/MOP/Immutable/Point.pm
Moose-2.1210/benchmarks/cmop/lib/MOP/Immutable/Point3D.pm
Moose-2.1210/benchmarks/cmop/lib/Bench/Accessor.pm
Moose-2.1210/benchmarks/cmop/lib/Bench/Construct.pm
Moose-2.1210/benchmarks/cmop/lib/Bench/Run.pm
Moose-2.1210/author/docGenerator.pl
Moose-2.1210/author/extract-inline-tests
Moose-2.1210/author/find-dupe-test-numbers
Entering Moose-2.1210
Checking configure dependencies from META.json
Checking if you have Dist::CheckConflicts 0.02 ... Yes (0.11)
Checking if you have ExtUtils::MakeMaker 6.30 ... Yes (6.66)
Checking if you have File::Spec 0 ... Yes (3.40)
Checking if you have ExtUtils::CBuilder 0.27 ... Yes (0.280210)
Running Makefile.PL
Configuring Moose-2.1210 ... cc: error trying to exec 'cc1': execvp: No such file or directory
This distribution requires a working compiler at Makefile.PL line 52.
! Configure failed for Moose-2.1210. See /home/hakon/.cpanm/work/1407056507.30283/build.log for details.
N/A

avconv: How to concatenate a bunch of flv files (h264 encoded video, adpcm_swf encoded audio)?

I want to concatenate some .flv files (each is h264/adpcm_swf encoded with the same settings). Ideally, I'd like to add something like a cut in between the files - a black screen for 1 or 2 seconds would suffice.
I've tried using avconv's "concat"-protocol, like this:
avconv -i concat:1.flv\|2.flv\|3.flv result.flv
That gives me a result, which contains only the contents of 1.flv and seems to be reencoded with the default flv-settings. That would be handable by giving appropriate output options, but in theory it should be possible to concatenate the files without much reencoding?
My avconv version:
avconv version 0.8.6-6:0.8.6-0ubuntu0.12.10.1, Copyright (c) 2000-2013 the Libav developers
built on Apr 2 2013 17:02:16 with gcc 4.7.2
avconv 0.8.6-6:0.8.6-0ubuntu0.12.10.1
libavutil 51. 22. 1 / 51. 22. 1
libavcodec 53. 35. 0 / 53. 35. 0
libavformat 53. 21. 1 / 53. 21. 1
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 15. 0 / 2. 15. 0
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 52. 0. 0 / 52. 0. 0
You can use ffmpeg for this concatenating movies. First check if you have ffmpeg installed by running ffmpeg. If the first line ends with "the FFmpeg developers", you're fine. If it is "the Libav developers", then ffmpeg is secretly an alias to avconv (this is the case on Ubuntu). If you don't have ffmpeg and the real ffmpeg is not in your repository, you have to compile ffmpeg yourself.
Now that you have the real ffmpeg, create the file inputs.txt with the following text:
file 1.flv
file 2.flv
file 3.flv
and run:
ffmpeg -f concat -i inputs.txt -c copy result.flv
Another way to concatenate files with ffmpeg without the need of store all the filenames in txt file is the following:
ffmpeg -f concat -i <(for f in *.flv; do echo "file '$f'"; done) -c copy result.flv
You could replace *.flv with whatever filetype you want. In that case do not forget to change the extension of the result file too.

Compiling Ncurses on Solaris - "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"?

I'm trying to compile a GNU stack on Solaris 10 (x86).
I've managed to get the following up so far:
GMP
MPFR
MPC
GCC
binutils
libiconv
gettext
I'm currently trying to build Ncurses, and I'm hitting an error:
/db/pub/eq/tools/bin/g++ -I../c++ -I../include -I/db/pub/eq/src/ncurses-5.9/c++ -DHAVE_CONFIG_H -D__EXTENSIONS__ -D_XOPEN_SOURCE=500 -D_FILE_OFFSET_BITS=64 -DNDEBUG -I. -I../include -I/db/pub/eq/src/ncurses-5.9/c++/../include -I/db/pub/eq/tools/include/ncurses -O2 -c /db/pub/eq/src/ncurses-5.9/c++/cursesf.cc -o ../objects/cursesf.o
<command-line>:0:0: warning: "_XOPEN_SOURCE" redefined [enabled by default]
<built-in>:0:0: note: this is the location of the previous definition
In file included from /usr/include/iso/stdlib_iso.h:30:0,
from /usr/include/stdlib.h:18,
from /db/pub/eq/src/ncurses-5.9/c++/internal.h:53,
from /db/pub/eq/src/ncurses-5.9/c++/cursesf.cc:34:
/db/pub/eq/tools/lib/gcc/i386-pc-solaris2.10/4.6.1/include-fixed/sys/feature_tests.h:341:2: error: #error "Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"
*** Error code 1
make: Fatal error: Command failed for target `../objects/cursesf.o'
Current working directory /db/pub/eq/src/ncurses-5.9/c++
*** Error code 1
make: Fatal error: Command failed for target `all'
I'm not quite sure what the above error (Compiler or options invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications) means, or how to troubleshoot it.
I saw this error once before when I was building MPC (during gmake check), but I had no idea what it meant then, or how to fix it - but since it was in checks, it was ok.
Cheers,
Victor
apply this patch to the configure script:
--- configure.orig Fri Aug 5 14:28:28 2011
+++ configure Fri Aug 5 14:31:11 2011
## -7246,7 +7246,7 ##
# setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer
;;
solaris2.1[0-9]) #(vi
- cf_xopen_source="-D__EXTENSIONS__ -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE"
+ cf_xopen_source="-D__EXTENSIONS__"
;;
solaris2.[1-9]) #(vi
cf_xopen_source="-D__EXTENSIONS__"
Ncurses 5.6 did not define _XOPEN_SOURCE for solaris either.
Cheers