Talk:Stream mythtv recordings to mobile devices
From MythTV
I've got the following updates when trying to get this to work (I've got ALMOST all the way there).. New mythexpire.pl to remove 3gp files with no associated mpg file (NOTE: you musn't have 3gp or mpg in the directory path, so /var/video/3gp/*.3gp is out) I've also got the latest ffmpeg running on fedora 7 with amr nb and wb support I've created SPECs for ffmpeg amrnb and amrwb although the static libraries are not installed by the rpm so you have to rpmbuild -bc ffmpeg3gp and manually "make install" to get the statics in. I've compiled mpeg4ip so that I can use it as an alternative hinter
If interested, I'll post the SPECs and the patches needed to get mpeg4ip working If anyone can help me get darwin working I'd love to hear why it refuses to serve up files even though it increments the counters for said files..
UPDATE: DSS only wants to serve files to quicktime, it refuses to serve RTSP to media player.. anyone know why?
mythexpire.pl
#!/usr/bin/perl
#Checks the myth recording directory for .3gp files that don't have a corresponding .mpg. If found, it deletes them.
#Change below to your myth recordings directory
$directory = "/video/recordings";
foreach $f (<$directory/*>) {
if ( $f =~ /\.3gp$/ )
{
$f =~ s/\.3gp$//;
if (!( -e "$f.mpg" )) {
$results = system("rm -f $f.3gp");
print "Removing orphaned file : $f.3gp\n"; };
};
};
myth3gp -- this converts mpgs to 3gps in the same directory, with the same name. This requires myth to run myth3gp %directory%%name% %name%
#!/bin/bash
out="/video/recordings"
logdir="/var/log/mythtv"
MENCODER="/usr/bin/mencoder"
MPLAYER="/usr/bin/mplayer"
FFMPEG3GP="/usr/bin/ffmpeg3gp"
MP4BOX="/usr/local/bin/MP4Box"
NICE="/bin/nice -n 15"
BITRATE="64k"
cd $out
outfile=`echo $2 | sed 's/ /_/g' | sed 's/://g'`
echo "START ($outfile): `date`" >> $logdir/myth3gp.log
if [ ! -s "$1" -o "$outfile" == "" ]
then
echo "usage: $0 [nuv-file] [showname]"
echo "END ($outfile): `date`" >> $logdir/myth3gp.log
echo "" >> $logdir/myth3gp.log
exit
fi
# Strip off the extensions
BASE1=`name=${1##*/};name0="${name%.*}";echo "${name0:-$name}"`
BASE2=`name=${2##*/};name0="${name%.*}";echo "${name0:-$name}"`
if [ "$BASE1" == "$BASE2" ]
then
# Drop the extension from the second parameter.. its a filename
outfile="$BASE2"
echo "FILENAMES MATCH ($outfile): `date`" >> $logdir/myth3gp.log
fi
#DEBUG - Notify the front end we are starting
/usr/bin/mythtvosd --template='scroller' --scroll_text="Starting 3GP conversion of $BASE1 -to- $outfile"
$NICE $MENCODER "$1" -quiet -nosound -ovc lavc -lavcopts vcodec=mpeg4 -vf expand=176:144,scale=176:144 -o "$out/$outfile.avi" -ofps 12
$NICE $MPLAYER -quiet -vo null -ao pcm:file=$out/$outfile.wav -af resample=8000,volume=+6db:sc "$1"
$NICE $FFMPEG3GP -y -i "$out/$outfile.avi" -i $out/$outfile.wav -b $BITRATE -ac 1 -ab 7.95k -map 0.0 -map 1.0 "$out/$outfile.3gp"
rm -f "$out/$outfile.avi" $out/$outfile.wav
if [ -e "$out/$outfile.3gp" ]
then
$NICE $MP4BOX -3gp -mtu 1450 -hint "$out/$outfile.3gp"
echo "CONVERTED ($outfile): `date`" >> $logdir/myth3gp.log
fi
echo "END ($outfile): `date`" >> $logdir/myth3gp.log
echo "" >> $logdir/myth3gp.log
ffmpeg3gp.spec -- modified version of ATRPMS ffmpeg spec (will require Axel's macros) file to allow ffmpeg to use 3gp
%bcond_with libgsm
%bcond_with x264
%bcond_with libnut
%bcond_with amr
%bcond_with everything
%bcond_with static
%lib_package avcodec 51
%lib_package avformat 51
%lib_package avutil 49
%lib_package postproc 51
%lib_package swscale 0
Summary: Hyper fast MPEG1/MPEG4/H263/RV and AC3/MPEG audio encoder
Name: ffmpeg
Version: 0.4.9
Release: 22.99_r8743%{?dist}
License: GPL
Group: System Environment/Libraries
#Source: http://prdownloads.sourceforge.net/%{name}/%{name}-%{version}-pre1.tar.gz
Source: %{name}-%{version}-r8743.tar.bz2
# These zipfiles come from the 3gpp website, read amr.c for more information on how to get them
Source1: 26104-610.zip
Source2: 26204-600.zip
URL: http://ffmpeg.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-root
BuildRequires: imlib2-devel, SDL-devel, freetype-devel, zlib-devel
BuildRequires: lame-devel
BuildRequires: libogg-devel, libvorbis-devel, libtheora-devel
BuildRequires: faad2-devel
BuildRequires: faac-devel
%{?with_libgsm:BuildRequires: libgsm-devel}
BuildRequires: xvidcore-devel
%{?with_x264:BuildRequires: x264-devel}
BuildRequires: a52dec-devel
BuildRequires: libdca-devel
#BuildRequires: libdc1394-devel, libraw1394-devel
%lib_dependencies
%description
FFmpeg is a very fast video and audio converter. It can also grab from a
live audio/video source.
The command line interface is designed to be intuitive, in the sense that
ffmpeg tries to figure out all the parameters, when possible. You have
usually to give only the target bitrate you want. FFmpeg can also convert
from any sample rate to any other, and resize video on the fly with a high
quality polyphase filter.
%devel_extra_Requires libogg-devel >= 1.1, libtheora-devel
%devel_extra_Requires libvorbis-devel,
%devel_extra_Requires libdca-devel, zlib-devel, xvidcore-devel, lame-devel
#devel_extra_Requires libdc1394-devel, libraw1394-devel
%devel_extra_Requires faac-devel, libX11-devel, libXext-devel
%ifarch x86_64
%devel_extra_Provides libavcodec.so()(64bit), libavformat.so()(64bit)
%else
%devel_extra_Provides libavcodec.so, libavformat.so
%endif
%prep
%setup -q
test -f version.h || echo "#define FFMPEG_VERSION \"%{evr}\"" > version.h
mkdir -p libavcodec/amr_float
mkdir -p libavcodec/amrwb_float
cd libavcodec/amr_float
unzip %SOURCE1
unzip -j *.zip
cp -f makefile.gcc Makefile
cd ../amrwb_float
unzip %SOURCE2
unzip -j *.zip
cp -f makefile.gcc Makefile
%build
./configure --prefix=%{_prefix} --libdir=%{_libdir} \
--shlibdir=%{_libdir} --mandir=%{_mandir} \
--enable-shared \
--enable-gpl \
--enable-pp \
--enable-swscaler \
--enable-pthreads \
--enable-x11grab \
\
--disable-dc1394 \
--enable-liba52bin \
--enable-libdts \
--enable-libfaac \
--enable-libfaadbin \
%{?with_libgsm:--enable-libgsm} \
%{?with_amr:--enable-amr-nb} \
%{?with_amr:--enable-amr-wb} \
--enable-libmp3lame \
%{?with_libnut:--enable-libnut} \
--enable-libogg \
--enable-libtheora \
--enable-libvorbis \
%{?with_x264:--enable-x264} \
%{?with_everything:--enable-amr-wb --enable-amr-nb --enable-x264 --enable-liba52 --enable-libfaad --enable-libgsm} \
%{?with_static:--enable-static} \
--enable-xvid \
%ifarch %ix86
--extra-cflags="%{optflags}" \
%else
--extra-cflags="%{optflags} -fPIC" \
%endif
--disable-strip
make
%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot} incdir=%{buildroot}%{_includedir}/ffmpeg
mkdir %{buildroot}%{_includedir}/postproc
ln %{buildroot}%{_includedir}/ffmpeg/postprocess.h %{buildroot}%{_includedir}/postproc
cat > develfiles.list << EOF
%defattr(-,root,root,-)
%doc COPYING CREDITS Changelog README doc/
%{_bindir}/*
%{_libdir}/vhook
EOF
# Remove from the included docs
rm -f doc/Makefile
%clean
rm -rf %{buildroot}
%files
%defattr(-,root,root,-)
%doc COPYING CREDITS Changelog README doc/
%{_bindir}/*
%{_libdir}/vhook
%changelog
* Mon Apr 23 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9-23_r8743
- Add some more dependencies (#1172).
* Sun Apr 22 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9-21_r8743
- Add some dependencies on the devel package (#1172).
* Sun Apr 15 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9-20_r8742
- Update to latest svn version.
* Wed Jan 3 2007 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9_19_r7407
- Update to latest svn version.
* Fri Oct 27 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9-18_r6524
- Add faac support.
* Mon Oct 2 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9-17_r6524
- Update to latest svn version.
- Fix revision in release tag.
* Wed Sep 6 2006 Axel Thimm <Axel.Thimm@ATrpms.net> - 0.4.9-15_r19707
- Update to latest svn version.
* Wed Mar 1 2006 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to cvs20060301.
- Fix bug #752.
* Mon Feb 27 2006 Axel Thimm <Axel.Thimm@ATrpms.net>
- Move compatibility provides to devel package (bug #750).
* Wed Feb 15 2006 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to cvs20060215.
* Sun Jun 12 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to cvs20050612.
* Tue May 17 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to cvs 20050517.
* Mon Apr 18 2005 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to cvs 20050418.
* Tue Nov 23 2004 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to 0.4.9-pre1.
* Thu Oct 16 2003 Axel Thimm <Axel.Thimm@ATrpms.net>
- Update to 0.4.8.
* Tue Jul 1 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Update to a CVS snapshot as videolan-client 0.6.0 needs it.
- Enable faad, imlib2 and SDL support.
- Disable mmx until it doesn't make the build fail anymore :-/
* Mon Mar 31 2003 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Rebuilt for Red Hat Linux 9.
- Hardcode provides in order to get it right :-/
* Tue Feb 25 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Moved libavcodec.so to the main package to fix dependency problems.
* Wed Feb 19 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Major spec file updates, based on a very nice Mandrake spec.
- Revert to the 0.4.6 release as CVS snapshots don't build.
* Tue Feb 4 2002 Matthias Saou <matthias.saou@est.une.marmotte.net>
- Initial RPM release.
amrwb -- is a modified amrnb spec file, both are posted here for completeness
# $Id: amrwb.spec 4701 2007-06-24 21:05:41Z local $ # Authority: weatherills.com Summary: AMR WideBand speech codec Name: amrwb Version: 7.0.0.1 Release: 2.fc7 License: LGPL Group: System Environment/Libraries URL: http://www.3gpp.org/ #Source: ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/kwm/amrwb-%{version}.tar.gz Source: http://distfiles.opendarwin.org/amrwb-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gcc-c++ %description AMR-WB is a wideband speech codec used in mobile phones. %package devel Summary: AMR WideBand speech codec development files Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel AMR-WB is a wideband speech codec used in mobile phones development files. %prep %setup %build %configure --enable-static %{__make} %{?_smp_mflags} %install %{__rm} -rf %{buildroot} %makeinstall %clean %{__rm} -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,0755) %doc COPYING %{_libdir}/libamrwb.so.* %files devel %defattr(-,root,root,0755) %{_includedir}/amrwb/ %{_libdir}/libamrwb.a %exclude %{_libdir}/libamrwb.la %{_libdir}/libamrwb.so %changelog * Wed Jun 27 2007 Brian Weatherill 7.0.0.1-2-custom - Modified freshrpms amrnb SPEC for amrwb -- Compiles on fc7
amrnb -- is a slightly modified amrnb spec file from freshrpms
# $Id: amrnb.spec 4701 2006-08-24 21:05:41Z dries $ # Authority: matthias Summary: AMR NarrowBand speech codec Name: amrnb Version: 6.1.0.4 Release: 2.fc7 License: LGPL Group: System Environment/Libraries URL: http://www.3gpp.org/ #Source: ftp://ftp.freebsd.org/pub/FreeBSD/ports/local-distfiles/kwm/amrnb-%{version}.tar.gz Source: http://distfiles.opendarwin.org/amrnb-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gcc-c++ %description AMR-NB is a narrowband speech codec used in mobile phones. %package devel Summary: AMR NarrowBand speech codec development files Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel AMR-NB is a narrowband speech codec used in mobile phones development files. %prep %setup %build %configure --enable-static %{__make} %{?_smp_mflags} %install %{__rm} -rf %{buildroot} %makeinstall %clean %{__rm} -rf %{buildroot} %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root,0755) %doc COPYING %{_libdir}/libamrnb.so.* %files devel %defattr(-,root,root,0755) %{_includedir}/amrnb/ %{_libdir}/libamrnb.a %exclude %{_libdir}/libamrnb.la %{_libdir}/libamrnb.so %changelog * Wed Jun 27 2007 Brian Weatherill 6.1.0.4-2-custom - Modified freshrpms amrnb SPEC for amrwb -- Compiles on fc7 * Fri Mar 17 2006 Matthias Saou <http://freshrpms.net/> 0.0.1-2 - Release bump to drop the disttag number in FC5 build. * Fri Dec 16 2005 Matthias Saou <http://freshrpms.net/> 0.0.1-1 - Spec file inclusion in rpmforge. * Wed Sep 07 2005 Thomas Vander Stichele <thomas at apestaart dot org> - 0.0.1-0.lvn.1: initial package
