I've been using ffmpeg wrapper and media mover to upload video files and transcode them to .flv format. This fails when the filename has spaces in it. I'm not exactly sure whether the bug that's causing this problem is in ffmpeg wrapper or media mover, but there are at least 2 functions in ffmpeg wrapper where a filename is passed to the shell without quotes around it: the functions ffmpeg_wrapper_file_duration, and ffmpeg_wrapper_file_data. In both of them, I think the line:

$output = ffmpeg_wrapper_run_command("-i $path");

should read:

$output = ffmpeg_wrapper_run_command("-i \'$path\'");

I've had a very quick look at mediamover, and it looks like the path strings are escaped in that module, so I'm reporting this as an ffmpeg_wrapper bug.

Comments

highfellow’s picture

P.S. I've just found out that changing those lines still hasn't fixed the problem. So maybe there's a bug somewhere else as well, possibly in Media Mover.

darrick’s picture

Version: 6.x-1.1-beta1 » 6.x-2.x-dev

Filenames with spaces appears to be fixed in v2. At least with the mm_ffmpeg module where single quotes are placed around the filename.

However, The ffmpeg_wrappper_class calls escapeshellcmd on the entire command. I have a filename like:

sites/encoder.davismedia.org/files/encoder/ingest/906-1 Digital Career Vision Presentation - Kathy Schoback - Sega of America (S-649) 906 (005918).mpg

So the (,),- characters are getting escaped even though the filename is in single quotes.

/usr/local/bin/ffmpeg -i 'sites/encoder.davismedia.org/files/encoder/ingest/906-1 Digital Career Vision Presentation - Kathy Schoback - Sega of America \(S-649\) 906 \(005918\).mpg' -vframes 1 -ss '00:00:02' -an -vcodec mjpeg -f rawvideo 'sites/encoder.davismedia.org/files/media_mover/test_custom_command/transform__create_a_thumbnail_image_from_a_video_file/906-1_Digital_Career_Vision_Presentation_-_Kathy_Schoback_-_Sega_of_America_\(S-649\)_906_\(005918\).mpg.thumbtest_custom_command.jpg' -v -1
darrick’s picture

I believe I've almost hammered out most of the bugs in my new configuration.

I'm using MM2 with the latest ffmpeg_wrapper. My config harvests from a local directory and then I run my own process which does two pass mp4 encoding and finally passes the file through qt-faststart.

Along with the issue in #2 I would get a error of "FFmpeg failed to create an output file." on the first pass.

My first pass function is: "ffmpeg -i %in_file -an -pass 1 -vcodec libx264 -vpre fastfirstpass -b 768k -bt 768k -threads 8 -f rawvideo -y /dev/null".

There is a typo in ffmpeg_wrapper_convert_file($params) which causes custom ffmpeg commands to never be run. Separate issue I'll file later.

But, a firstpass encode doesn't generate a output file. However, the current ffmpeg_wrapper assumes an output file.

The solution I have now involves setting $ffmpeg->input_file and $ffmpeg->output_file before running $ffmpeg->command. Then the $ffmpeg->command does the job of replacing %in_file and %out_file in the command.

Nathan Goulding’s picture

Check out this patch: http://drupal.org/node/1199438

arthurf’s picture

@darrick looking at the command you're running- shouldn't the -y param be -y %out_file ?