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.
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | 865956-20-empty-dimensions-value.patch | 1.08 KB | Jorrit |
| 6.x-4.0-rc7.patch | 568 bytes | nathan.zhu |
Comments
Comment #1
hypertext200Comment #2
nathan.zhu commentedComment #3
iLLin commentedThis will break if you edit your video after creating it. Something else is going on here as this needs "default_value" not "value".
Comment #4
nathan.zhu commenteddid 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.
Comment #5
hypertext200Please check the meta data settings, do you have FLVTools2 installed?
Comment #6
reltnek commentedI've got a similar problem. Looking at the database, I notice that the 'dimensions' field in the video_files table is completely empty.
Comment #7
reltnek commentedNathan 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.
Comment #8
hypertext200if your using filefield_meta module this might happen.
Comment #9
narendrak commentedsame Problem .. any solution ?
-thx in Adv..
Comment #10
hypertext200Please check the meta data settings and update it like in http://drupal.org/node/848294#comment-3184978
Comment #11
hypertext200Comment #12
michaelscappa commentedReopening 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:
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.
Comment #13
michaelscappa commentedComment #14
michaelscappa commentedI'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...
Comment #15
dim_nsk commentedI'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'.
Comment #16
hypertext200This issue won't fix as we redesigned the transcoding interfaces to minimize those kind of risks
Comment #17
osopolarThe 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.
Comment #18
osopolarSet to active.
Comment #19
jruberto commentedSubscribing.
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.
Comment #20
Jorrit commentedI 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.
Comment #21
Jorrit commentedThe 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.
Comment #22
Jorrit commentedThis fix has been released in Video 6.x-4.3-rc1. Please take a look and test the release candidate.