[mythtv-users] user job using ffmpeg

Jim Judd jim at cincojudds.com
Fri Nov 23 19:26:16 UTC 2012


Hello everyone,
I've been using mythtv for a while now and love it.  I've gotten to the 
point where I want to start transcoding some shows.  I've looked and 
tried a few of the scripts that I've found but nothing has really fit on 
how I want to do it.  So I started learning python so I could setup up a 
script as a user job to transcode some of my recordings.

My current machine is a
Linux corscant 3.5.7-gentoo #5 SMP Sun Nov 18 15:34:58 CST 2012 x86_64 
Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz GenuineIntel GNU/Linux

mythtv-0.25.2
python2.7
ffmpeg version 0.10.3 Copyright (c) 2000-2012 the FFmpeg developers
   built on Nov 20 2012 14:27:12 with gcc 4.5.4
   configuration: --prefix=/usr --libdir=/usr/lib64 
--shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared 
--cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ 
--ar=x86_64-pc-linux-gnu-ar --optflags='-march=core2 -O2 -pipe' 
--extra-cflags='-march=core2 -O2 -pipe' --extra-cxxflags='-march=core2 
-O2 -pipe' --disable-static --enable-gpl --enable-version3 
--enable-postproc --enable-avfilter --disable-stripping --disable-debug 
--disable-doc --disable-network --disable-vaapi --disable-vdpau 
--enable-runtime-cpudetect --enable-libmp3lame --enable-libvo-aacenc 
--enable-libvorbis --enable-libx264 --enable-libxvid --enable-libfaac 
--enable-nonfree --disable-indev=v4l --disable-indev=oss 
--disable-indev=jack --enable-x11grab --enable-libv4l2 
--disable-outdev=oss --enable-libfreetype --enable-pthreads 
--disable-amd3dnow --disable-amd3dnowext --disable-altivec --disable-avx 
--disable-mmx2 --disable-vis --disable-neon --cpu=core2 
--enable-hardcoded-tables
   libavutil      51. 35.100 / 51. 35.100
   libavcodec     53. 61.100 / 53. 61.100
   libavformat    53. 32.100 / 53. 32.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 61.100 /  2. 61.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  6.100 /  0.  6.100
   libpostproc    52.  0.100 / 52.  0.100

The problem that I have now is that I can run the script from a bash 
shell and everything works great, but when I put it in as a user job I 
get the following error:

ffmpeg version 0.10.3 Copyright (c) 2000-2012 the FFmpeg developers
   built on Nov 20 2012 14:27:12 with gcc 4.5.4
   configuration: --prefix=/usr --libdir=/usr/lib64 
--shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared 
--cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ 
--ar=x86_64-pc-linux-gnu-ar --optflags='-march=core2 -O2 -pipe' 
--extra-cflags='-march=core2 -O2 -pipe' --extra-cxxflags='-march=core2 
-O2 -pipe' --disable-static --enable-gpl --enable-version3 
--enable-postproc --enable-avfilter --disable-stripping --disable-debug 
--disable-doc --disable-network --disable-vaapi --disable-vdpau 
--enable-runtime-cpudetect --enable-libmp3lame --enable-libvo-aacenc 
--enable-libvorbis --enable-libx264 --enable-libxvid --enable-libfaac 
--enable-nonfree --disable-indev=v4l --disable-indev=oss 
--disable-indev=jack --enable-x11grab --enable-libv4l2 
--disable-outdev=oss --enable-libfreetype --enable-pthreads 
--disable-amd3dnow --disable-amd3dnowext --disable-altivec --disable-avx 
--disable-mmx2 --disable-vis --disable-neon --cpu=core2 
--enable-hardcoded-tables
   libavutil      51. 35.100 / 51. 35.100
   libavcodec     53. 61.100 / 53. 61.100
   libavformat    53. 32.100 / 53. 32.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 61.100 /  2. 61.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  6.100 /  0.  6.100
   libpostproc    52.  0.100 / 52.  0.100
[mpegts @ 0xd08320] PES packet size mismatch
     Last message repeated 1 times
Input #0, mpegts, from '/home/mythtv/recordings/1271_20121122183000.mpg':
   Duration: 00:29:58.21, start: 6159.017167, bitrate: 14060 kb/s
   Program 1
     Stream #0:0[0xddf]: Video: mpeg2video (Main) ([2][0][0][0] / 
0x0002), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 13950 kb/s, 59.96 fps, 
59.94 tbr, 90k tbn, 119.88 tbc
     Stream #0:1[0xde0](eng): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
5.1(side), s16, 448 kb/s
     Stream #0:2[0xde1](spa): Audio: ac3 (AC-3 / 0x332D4341), 48000 Hz, 
stereo, s16, 192 kb/s
[buffer @ 0xd0db90] w:1280 h:720 pixfmt:yuv420p tb:1/1000000 sar:1/1 
sws_param:
[libx264 @ 0xd0ec40] using SAR=1/1
[libx264 @ 0xd0ec40] using cpu capabilities: MMX2 SSE2Fast SSSE3 
FastShuffle SSE4.2 AVX
[libx264 @ 0xd0ec40] ratecontrol_init: can't open stats file
Output #0, mp4, to '/home/mythtv/videos/The Big Bang Theory/The 
Grasshopper Experiment.mp4':
     Stream #0:0: Video: h264, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 
q=10-51, pass 1, 2500 kb/s, 90k tbn, 30 tbc
     Stream #0:1(eng): Audio: none, 48000 Hz, 5.1(side), s16, 128 kb/s
Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video -> libx264)
   Stream #0:1 -> #0:1 (ac3 -> libfaac)
Error while opening encoder for output stream #0:0 - maybe incorrect 
parameters such as bit_rate, rate, width or height

The command line for ffmpeg is the following:

/usr/bin/ffmpeg -y -i <in mpeg 2 file> -pass 1 -vcodec libx264 -b:v 
2500k -g 30 -bf 3 -refs 6 -b_strategy 1 -coder 1 -qmin 10 -qmax 51 
-sc_threshold 40 -flags +loop -cmp +chroma -me_range 16 -me_method umh 
-subq 7 -i_qfactor 0.71 -qcomp 0.6 -qdiff 4 -directpred 3 -flags2 
+dct8x8+wpred+bpyramid+mixed_refs -trellis 1 -partitions 
+parti8x8+parti4x4+partp8x8+partp4x4+partb8x8 -acodec libfaac -ab 44100 
<outputfile>

Since it works in a bash shell I'm not sure why it errors out when 
mythtv launches the user job.  Can anyone see something that I'm missing 
or know if anything special I need to do when setting up user jobs?

Thanks!





More information about the mythtv-users mailing list