I am getting this error when trying to transcode files with FFmpeg:

PHPVideoToolkit Error: Execute error. Output for file "/sites/default/files/videos/original/example.mov" was not found. No images were generated.

The source file is successfully uploaded to the server and placed into the sites/default/files/videos/original directory, and automatic thumbnails are generated from it. But the transcoding job fails with this error.

I have a working copy of FFmpeg, so I know it's able to transcode in the command line. As stated previously in another issue, I think this may have to do with the settings in the Video presets tab, because when it's changed from "none" to something specific, the cron jobs fail completely.

CommentFileSizeAuthor
#4 ffmpeg-formats.txt8.35 KBmichael.k
#4 ffmpeg-codecs.txt15.18 KBmichael.k

Comments

Jorrit’s picture

Status: Active » Postponed (maintainer needs more info)

I believe that I have fixed this problem last week in the 7.x-2.x-dev version. Could you check if this is the case for you as well?

michael.k’s picture

Thanks for the reply.

I have painstakingly created a new test site from scratch with minimal modules and three manually created presets in order to demonstrate this issue (and others).

In order to help with troubleshooting, I have outlined the details of my process in the first node as a sort of "recipe":
http://video6.mkdev.org/node/1

Finally, when I uploaded a video for the second node (853x480, 156.3MB), only one out of three transcoding jobs succeeded:
http://video6.mkdev.org/node/2

mkdev.org [/sites/all/modules/video]# drush cron
sh: line 1:  4586 Segmentation fault      /usr/bin/ffmpeg -i '/sites/default/files/videos/original/videoTest-480p-16x9-DVCPRO50-1.mov' -vcodec 'libx264rgb' -s '640x360' -acodec 'libfaac' -ac '2' /tmp/1329683899-4f415dbb7102e.mp4 2>&1
WD transcoder: PHPVideoToolkit Error: Execute error. It was not possible to encode                                                                                      [error]
"/sites/default/files/videos/original/videoTest-480p-16x9-DVCPRO50-1.mov" as FFmpeg returned an error. The error is with the audio codec
of the input file. FFmpeg reports the error to be "Error while opening encoder for output stream #0:1 - maybe incorrect parameters such as bit_rate, rate, width or
height".
Cron run successfully.                                                                                                                                                  [success]
mkdev.org [/sites/all/modules/video]#

(By the way, using "drush cron" and getting errors *always* kills my shell, so I have to exit and log back in to resume work.)

Here is what exists in the /videos/converted directory. Notice the webm version is missing and the mp4 version is crippled with no content:

mkdev.org [/sites/default/files/videos/converted/1]# ls -la
total 816
drwxrwxr-x 2 mkdev mkdev   4096 Feb 19 12:38 ./
drwxr-xr-x 3 mkdev mkdev   4096 Feb 19 12:38 ../
-rw-r--r-- 1 mkdev mkdev     48 Feb 19 12:38 videoTest-480p-16x9-DVCPRO50-1_mp4_1329683899.mp4
-rw-r--r-- 1 mkdev mkdev 815351 Feb 19 12:38 videoTest-480p-16x9-DVCPRO50-1_ogg_1329683899.ogg
mkdev.org [/sites/default/files/videos/converted/1]# 
Jorrit’s picture

It could by that your FFmpeg version does not support WebM or MP4 (H.264). By what method have you installed FFmpeg?

michael.k’s picture

StatusFileSize
new15.18 KB
new8.35 KB

No, I can create any output on the command line.

These commands produce viable, transcoded versions of the DVCPRO50 source file:

ffmpeg -i videoTest-480p-16x9-DVCPRO50-1.mov -sameq -acodec libvorbis conversion.webm
ffmpeg -i videoTest-480p-16x9-DVCPRO50-1.mov -sameq -acodec libvorbis conversion.ogv
ffmpeg -i videoTest-480p-16x9-DVCPRO50-1.mov -sameq conversion.mp4

It was necessary for me to create a custom installation script for FFmpeg (for CentOS 5) in order to have a full copy that is non-distributable. This is where most people hit the wall and, indeed, it took a tremendous amount of effort, with lots of trial and error testing with the compile options for many external containers and codecs. But I finally produced a collection of sources that would compile on their own and build with FFmpeg to create files with the output that I need. Admittedly, it's not perfect, but it works.

Attached is the output for "ffmpeg -formats" and "ffmpeg -codecs" so you can verify this if you wish.

Here are the contents of the above files when queried by FFmpeg:

# ffmpeg -i conversion.webm 
Input #0, matroska,webm, from 'conversion.webm':
  Duration: 00:00:21.70, start: 0.000000, bitrate: 244 kb/s
    Stream #0:0(eng): Video: vp8, yuv420p, 720x480, SAR 109:90 DAR 109:60, 29.97 fps, 29.97 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: vorbis, 44100 Hz, stereo, s16 (default)


# ffmpeg -i conversion.ogv
[ogg @ 0x1d9cb7e0] Broken file, keyframes not correctly marked.
    Last message repeated 10 times
[ogg @ 0x1d9cb7e0] max_analyze_duration 5000000 reached at 5005000
Input #0, ogg, from 'conversion.ogv':
  Duration: 00:00:21.68, start: 0.000000, bitrate: 467 kb/s
    Stream #0:0: Video: theora, yuv422p, 720x480 [SAR 40:33 DAR 20:11], 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: vorbis, 44100 Hz, stereo, s16, 45 kb/s
    Metadata:
      MAJOR_BRAND     : qt  
      MINOR_VERSION   : 537199360
      COMPATIBLE_BRANDS: qt  
      CREATION_TIME   : 2012-02-19 20:32:55
      ENCODER         : Lavf54.0.100


# ffmpeg -i conversion.mp4 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'conversion.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2012-02-19 20:32:55
    encoder         : Lavf54.0.100
  Duration: 00:00:21.75, start: 0.000000, bitrate: 552 kb/s
    Stream #0:0(eng): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p, 720x480 [SAR 40:33 DAR 20:11], 481 kb/s, SAR 32:27 DAR 16:9, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2012-02-19 20:32:55
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 63 kb/s
    Metadata:
      creation_time   : 2012-02-19 20:32:55
      handler_name    : 
Jorrit’s picture

First of all, do you still experience the error that you gave in the first post of this issue with the latest 7.x-2.x-dev version?

Secondly, is the following command working when you execute it from the Drupal base directory:

/usr/bin/ffmpeg -i '/sites/default/files/videos/original/videoTest-480p-16x9-DVCPRO50-1.mov' -vcodec 'libx264rgb' -s '640x360' -acodec 'libfaac' -ac '2' /tmp/1329683899-4f415dbb7102e.mp4

michael.k’s picture

Thanks for being so responsive, Jorrit, I have seen your many posts over the last few weeks and your hard work is very much appreciated!

To answer your questions in order, yes and no.

But regarding the second question, if I change libx264rgb to libx264, it works.

Jorrit’s picture

When I look at your codecs list, libx264rgb is listed as "EV", meaning that it Encodes Video. libx264 is only listed as Video. What is the output on the command line?

michael.k’s picture

I get a segmentation fault. Here is the output:

# /usr/bin/ffmpeg -i videoTest-480p-16x9-DVCPRO50-1.mov -vcodec 'libx264rgb' -s '640x360' -acodec 'libfaac' -ac '2' /tmp/1329683899-4f415dbb7102e.mp4
ffmpeg version git-2012-02-10-1b7ff90 Copyright (c) 2000-2012 the FFmpeg developers
  built on Feb 17 2012 12:44:06 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
  configuration: --arch=x86_64 --disable-avisynth --enable-avfilter --enable-bzlib --enable-gpl --enable-libdirac --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-pthreads --enable-runtime-cpudetect --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab --enable-zlib --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --incdir=/usr/include --libdir=/usr/lib64 --mandir=/usr/share/man --prefix=/usr --shlibdir=/usr/lib64
  libavutil      51. 39.100 / 51. 39.100
  libavcodec     54.  1.100 / 54.  1.100
  libavformat    54.  0.100 / 54.  0.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 62.100 /  2. 62.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0.  6.100 /  0.  6.100
  libpostproc    52.  0.100 / 52.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'videoTest-480p-16x9-DVCPRO50-1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2012-02-19 20:32:55
  Duration: 00:00:21.68, start: 0.000000, bitrate: 57663 kb/s
    Stream #0:0(eng): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, s16, 113 kb/s
    Metadata:
      creation_time   : 2012-02-19 20:32:55
      handler_name    : ?Apple Alias Data Handler
    Stream #0:1(eng): Video: dvvideo (dv5n / 0x6E357664), yuv422p, 720x480 [SAR 32:27 DAR 16:9], 57542 kb/s, SAR 40:33 DAR 20:11, 29.97 fps, 29.97 tbr, 30k tbn, 29.97 tbc
    Metadata:
      creation_time   : 2012-02-19 20:32:55
      handler_name    : ?Apple Alias Data Handler
Incompatible pixel format 'yuv422p' for codec 'libx264rgb', auto-selecting format 'bgr24'
[buffer @ 0x195546a0] w:720 h:480 pixfmt:yuv422p tb:1/1000000 sar:40/33 sws_param:
[scale @ 0x19554d00] w:720 h:480 fmt:yuv422p -> w:640 h:360 fmt:bgr24 flags:0x4
[libx264rgb @ 0x19583680] using SAR=45/44
[libx264rgb @ 0x19583680] using cpu capabilities: MMX2 SSE2Fast FastShuffle LZCNT
[libx264rgb @ 0x19583680] profile High 4:4:4 Predictive, level 3.0, 4:4:4 8-bit
[libx264rgb @ 0x19583680] 264 - core 120 r2164 da19765 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to '/tmp/1329683899-4f415dbb7102e.mp4':
  Metadata:
    major_brand     : qt  
    minor_version   : 537199360
    compatible_brands: qt  
    creation_time   : 2012-02-19 20:32:55
    encoder         : Lavf54.0.100
    Stream #0:0(eng): Video: h264 (![0][0][0] / 0x0021), bgr24, 640x360 [SAR 45:44 DAR 20:11], q=-1--1, 30k tbn, 29.97 tbc
    Metadata:
      creation_time   : 2012-02-19 20:32:55
      handler_name    : ?Apple Alias Data Handler
    Stream #0:1(eng): Audio: aac (@[0][0][0] / 0x0040), 44100 Hz, 2 channels, s16, 128 kb/s
    Metadata:
      creation_time   : 2012-02-19 20:32:55
      handler_name    : ?Apple Alias Data Handler
Stream mapping:
  Stream #0:1 -> #0:0 (dvvideo -> libx264rgb)
  Stream #0:0 -> #0:1 (aac -> libfaac)
Press [q] to stop, [?] for help
Segmentation fault
Jorrit’s picture

What version of libx264 do you use? I just build ffmpeg and libx264 using the very latest git versions and now libx264 is also showing with EV again. You might want to try that. Also, after you've built FFmpeg, clear the Drupal cache. Information about the supported codecs is cached.

Another question: what is the exact value given for the "Video codec" setting on the preset settings page?

michael.k’s picture

Thinking about this some more, there may be an issue with either FFmpeg or x264 during compile. As you point out, the codec libx264rgb should work because it shows as EV, but I'm thinking that the flags are actually reversed and libx264 should have the EV flag instead, because that's the one that works.

This is how "ffmpeg -codecs" reads now:

Codecs:
 D..... = Decoding supported
 .E.... = Encoding supported
 ..V... = Video codec
 ..A... = Audio codec
 ..S... = Subtitle codec
 ...S.. = Supports draw_horiz_band
 ....D. = Supports direct rendering method 1
 .....T = Supports weird frame truncation
 ------
 
... (other codecs deleted)

   V    libx264         libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
  EV    libx264rgb      libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB

... (other codecs deleted

Note, the names of encoders and decoders do not always match, so there are
several cases where the above table shows encoder only or decoder only entries
even though both encoding and decoding are supported. For example, the h263
decoder corresponds to the h263 and h263p encoders, for file formats it is even
worse.

Is there a way to force the libx264 codec instead of libx264rgb?

I'm not sure how else you could populate the list of codecs and formats for the drop downs in the preset configuration screen, but given the caveat at the bottom of the "ffmpeg -codecs" output (above), perhaps relying on this is causing a wider set of problems.

Maybe one way to address this is to allow phpvideotoolkit.php5.php to include the codecs with the V flag, not just EV? It's not an elegant solution, but this way a user could override the list generated by FFmpeg and compensate for inaccuracies within FFmpeg.

As far as I can tell, the Video preset function is the culprit for this issue, and the primary reason I can't create the output I need because I can do everything fine via the command line. If there were some way to override the defaults in the drop downs (i.e., forcing options or supplying a custom field that specifies parameters in a command line), then maybe that would supply a workaround for the many complicated issues that have to work together -- as well as another troubleshooting option for this module.

Thanks again for your help.

Jorrit’s picture

What version of FFmpeg and libx264 do you use? If git, from which date?

michael.k’s picture

Sorry I didn't see your post when I submitted mine.

x264 version is from git, 0.120.2164 da19765:

# /usr/local/bin/x264 --version
x264 0.120.2164 da19765
(libswscale 2.1.100)
built on Feb 17 2012, gcc: 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --bit-depth=8 --chroma-format=all
x264 license: GPL version 2 or later
libswscale license: nonfree and unredistributable
WARNING: This binary is unredistributable!

FFmpeg version git-2012-02-10-1b7ff90:

# /usr/bin/ffmpeg -version
ffmpeg version git-2012-02-10-1b7ff90
built on Feb 17 2012 12:44:06 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --arch=x86_64 --disable-avisynth --enable-avfilter --enable-bzlib --enable-gpl --enable-libdirac --enable-libfaac --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-pthreads --enable-runtime-cpudetect --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab --enable-zlib --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --incdir=/usr/include --libdir=/usr/lib64 --mandir=/usr/share/man --prefix=/usr --shlibdir=/usr/lib64
libavutil      51. 39.100 / 51. 39.100
libavcodec     54.  1.100 / 54.  1.100
libavformat    54.  0.100 / 54.  0.100
libavdevice    53.  4.100 / 53.  4.100
libavfilter     2. 62.100 /  2. 62.100
libswscale      2.  1.100 /  2.  1.100
libswresample   0.  6.100 /  0.  6.100
libpostproc    52.  0.100 / 52.  0.100
michael.k’s picture

You were right, re-compiling from today's git versions of x264 and FFmpg has changed the list of codecs to show EV for libx264. I cleared the cache and was able to select the non-rgb version of libx264.

So the good news is that a beautiful and small mp4 file was created from the source! (From 156.3MB to 1.7MB)

But the bad news is that I got an error during the cron job, and the ogg was not transcoded (whereas it was before). Plus webm is still not transcoding. Perhaps the whole job dies when one fails? I've cleared all caches with "drush cc" and tried to re-save the presets, but still no luck.

Here is the cron error:

# drush cron
WD transcoder: Error set options PHPVideoToolkit Error: Value "libx264" set from $toolkit->setVideoCodec, can not be used to encode the output as the version of FFmpeg that you are using does not have the capability to encode video with this codec.                   [error]
WD transcoder: Video conversion has been failed!. Please check further logs for debugging.                                                                                                                                                                                 [warning]
Cron run successfully.  
michael.k’s picture

I can confirm that the mp4 error kills other jobs that are pending -- even though the mp4 job finishes with a functional transcoded video.

I built a new site from scratch based on the 7.x-2.4+23-dev version (February 20, 2012 - 16:52), testing each format individually, then together. Since the mp4 transcoding job killed the other formats, I turned off mp4 and ran another job with only webm and ogg. That worked, and I got two functional video files.

Is there any way to change the order in which these formats are transcoded?

Here is the error:

# drush cron
WD transcoder: Error set options PHPVideoToolkit Error: Value "libx264" set from                   [error]
$toolkit->setVideoCodec, can not be used to encode the output as the version of FFmpeg that you are
using does not have the capability to encode video with this codec.
WD transcoder: Video conversion failed!. Please check logs for debugging.                          [warning]
Cron run successfully.
Jorrit’s picture

Does the file /tmp/_ffmpeg_info.php exist? If so, delete it and try again.

michael.k’s picture

Great call, Jorrit, killing the tmp file fixed it!!

I'm now able to transcode mp4, webm, ogg, and flv all at once, and the /files/videos/converted sub-directory is populated with viable clips!

THANK YOU

Jorrit’s picture

That's great to hear. I am going to commit some code that prevents that file from being used.

Jorrit’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fixed in 7.x-2.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.