Hi, everyone

I use video modules 6.x-4.0-rc7 version, a strange problem with convert video with ffmpeg command, converted folder get empty flv files after

run video_scheduler.php script, step to step follow the video module code, I found the ffmpeg command line have problem like below

/usr/bin/ffmpeg -y -i sites/default/files/videos/original/MVI_0099.AVI -f flv -ar 22050 -ab 64000 -s 0x0 -padtop 0 -padbottom 0 -b 200000 -qscale 1 sites/default/files/videos/converted/MVI_0099.flv

I get frame error through this line, everybody can find parameter -s with wrong dimensions, ffmpeg can't understood 0x0 size. that's why it can't

create flv files in converted folder, because missing dimension size for flv file.

After another round research code, I found it where is problem, column dimensions get empty in videos_files table, here should store what flv

video dimension size want to convert with ffmpeg command, so need change some code in video.module like below

line 324:
$file['data']['dimensions'] = $element['data']['dimensions']['#value'];

change to:
$file['data']['dimensions'] = $element['data']['dimensions']['#default_value'];

Now should get correct dimension size for convert video and ffmpeg command line will no error, good luck.

Here is a patch file uploaded.

Comments

hypertext200’s picture

Status: Active » Needs review
nathan.zhu’s picture

Assigned: nathan.zhu » Unassigned
iLLin’s picture

This will break if you edit your video after creating it. Something else is going on here as this needs "default_value" not "value".

nathan.zhu’s picture

did you guys facing samed problem on this part. in table video_files still get empty value for dimensions character. so doesn't happen error when you guys use ffmpeg to convert video? how could be.

hypertext200’s picture

Please check the meta data settings, do you have FLVTools2 installed?

reltnek’s picture

I've got a similar problem. Looking at the database, I notice that the 'dimensions' field in the video_files table is completely empty.

reltnek’s picture

Nathan is right about line 324 in video.module being part of the bug train:

line 324:
$file['data']['dimensions'] = $element['data']['dimensions']['#value'];

Doing a dump of the $element variable shows that there is no '#value' key for the 'dimensions' array. Changing to the '#default_value' key will ignore user input, which is not generally desired. I think that perhaps the 'data' branch of the $element variable is the wrong one to be using.

hypertext200’s picture

Status: Needs review » Active

if your using filefield_meta module this might happen.

narendrak’s picture

same Problem .. any solution ?

-thx in Adv..

hypertext200’s picture

Please check the meta data settings and update it like in http://drupal.org/node/848294#comment-3184978

hypertext200’s picture

Status: Active » Fixed
michaelscappa’s picture

Reopening as this is not fixed. Still getting empty dimensions for !size. The select list is not the problem (the selections show up fine).

My output:

WD php: Division by zero in /var/www/vhosts/drupal-6.19-fusion/sites/all/modules/video/transcoders/video_ffmpeg.inc on line [error]
515.
WD php: Division by zero in /var/www/vhosts/drupal-6.19-fusion/sites/all/modules/video/transcoders/video_ffmpeg.inc on line [error]
520.
WD video_conversion: Video conversion failed.  FFMPEG reported the following output: FFmpeg version                         [error]
SVN-r19352-4:0.5+svn20090706-2ubuntu2.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
  configuration: --extra-version=4:0.5+svn20090706-2ubuntu2.2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf
--enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc
--enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include
--enable-shared --disable-static
  libavutil     49.15. 0 / 49.15. 0
  libavcodec    52.20. 0 / 52.20. 0
  libavformat   52.31. 0 / 52.31. 0
  libavdevice   52. 1. 0 / 52. 1. 0
  libavfilter    0. 4. 0 /  0. 4. 0
  libswscale     0. 7. 1 /  0. 7. 1
  libpostproc   51. 2. 0 / 51. 2. 0
  built on Apr 23 2010 15:05:49, gcc: 4.4.1
[wmv3 @ 0x9d786b0]Old WMV3 version detected, only I-frames will be decoded

Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 15.00 (15/1)
Input #0, asf, from 'sites/default/files/videos/original/niceday_1.wmv':
  Duration: 00:00:31.82, start: 3.000000, bitrate: 259 kb/s
    Stream #0.0: Audio: wmav2, 44100 Hz, stereo, s16, 65 kb/s
    Stream #0.1: Video: wmv3, yuv420p, 320x240, 250 kb/s, 15 tbr, 1k tbn, 1k tbc
Incorrect frame size

Division by zero in /var/www/vhosts/drupal-6.19-fusion/sites/all/modules/video/transcoders/video_ffmpeg.inc on line 515.    [warning]
Division by zero in /var/www/vhosts/drupal-6.19-fusion/sites/all/modules/video/transcoders/video_ffmpeg.inc on line 520.    [warning]

My command being executed:
nice -n 19 /usr/bin/ffmpeg -y -i sites/default/files/videos/original/niceday_1.wmv -f flv -ar 22050 -ab 64000 -s 0x0 -padtop 0 -padbottom 0 -b 200000 -qscale 1 sites/default/files/videos/converted/niceday_1.flv 2>&1

Note the 0x0

If I manually change !size to 640x480 (or some other resolution) it works but I still get the illegal division by zero errors, as I would expect.

michaelscappa’s picture

Status: Fixed » Active
michaelscappa’s picture

I've tracked down the issue a bit further.

If you hit SAVE but DON'T hit the UPLOAD button on the individual files, data(array) is blank and it does not work, but instead of taking the #default_value from element, this seems to work better:

//$file['data']['dimensions'] = $element['data']['dimensions']['#value'];
$file['data']['dimensions'] = $file['field']['widget']['default_dimensions'];

hopefully this helps somebody...

dim_nsk’s picture

I've got same problem too.
I've installed filefield_meta module and video module.
In field dimensions in table video_files there is no data inserted. Therefore ffmpeg process with error.
To get 'default_dimensions' is not solution. I need value by field 'dimensions'.

hypertext200’s picture

Status: Active » Closed (won't fix)

This issue won't fix as we redesigned the transcoding interfaces to minimize those kind of risks

osopolar’s picture

Version: 6.x-4.0-rc7 » 6.x-4.2

The problem is still there. In video_convert_process() we set: $file['data']['dimensions'] = $element['data']['dimensions']['#value']; ... but there is no $element['data']['dimensions']['#value'].

This results in an empty dimension in video_files table and end in:

Division by zero in /path-to-drupal/sites/default/modules/video/transcoders/video_ffmpeg.inc on line 487.
Division by zero in /path-to-drupal/sites/default/modules/video/transcoders/video_ffmpeg.inc on line 492.

osopolar’s picture

Status: Closed (won't fix) » Active

Set to active.

jruberto’s picture

Subscribing.

I'm testing using the hack suggested in the original post which is fine for the particular site i'm working on, i kind of want to enforce the default anyway. Clumsy & kludgey, but this is kind of a showstopper for me. Metadata settings / flvtool does not change or fix anything for me.

Jorrit’s picture

StatusFileSize
new1.08 KB

I also encountered this situation once. I can't reproduce it anymore. I have attached a patch that makes it impossible to add a row to the video_files table that has an empty dimensions value. This makes it easier to debug when the wrong row is added. I hope this patch can be added to the sources and that someone is able to find a list of steps that consistently reproduce this error.

Jorrit’s picture

Status: Active » Fixed

The patch from nathan.zhu is correct, as can also be deducted from the fact that the comment in the code says "Add default dimensions from our default_value if needed", but then proceeds to add #value and not #default_value. The code is hit when the user saves the form right after selecting a file, instead of first uploading the file. The user has not been able to select a resolution at that point, so in my opinion taking the default is the best thing that can be done.

In #14, michaelscappa suggests to use the default dimensions value of the widget, but that value should in principle be the same as #default_value of the selector element. It should not matter which source is used.

I will commit a fix for this bug shortly. It will be the patch of the original issue reporter, but with some more comments to detail the cause of the field #value being empty.

Jorrit’s picture

This fix has been released in Video 6.x-4.3-rc1. Please take a look and test the release candidate.

Status: Fixed » Closed (fixed)

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