I am wondering that all my videos only start to playing until they got completely downloaded. At first obviously it was my fault, because of the missing qt-faststart. After enabling and retranscoding I was wondering again that nothing changes. So i testest on the commandline the qt-faststart command and it worked. So I searched in the video module for the qt-faststart command but I couldn't find it. My question is now is it not implemented? I think nowadays the people, which visit your video blog or similar, wont want to wait until the movie is downloaded. They think the video is broken and left the page. This is the reason for me to mark it as critical.

Comments

broncomania’s picture

I just wrote a small piece of code to make qt-faststart work.

Add in the TranscoderAbstractionFactoryFfmpeg Class in the function execute behind

    // Lets check to make sure our file exists, if not error out
    $output_file = $this->settings['base_url'] . '/' . $this->settings['filename'];

this. But there is currently no check if qt-faststart is installed. This would be nessesary to automatically provide this function.

    // qt-faststart
    $qt_faststart_output_file = $this->settings['base_url'] . '/qt-' . $this->settings['filename'];
    $qt_faststart_cmd = 'qt-faststart '. drupal_realpath($output_file) . ' '.drupal_realpath($qt_faststart_output_file);
    exec($qt_faststart_cmd);
    file_unmanaged_delete(drupal_realpath($output_file));
    $this->settings['filename'] = 'qt-' . $this->settings['filename'];
    $output_file = $qt_faststart_output_file;

Now your movies will played directly after clicking the play button instead of waiting until your movie is completely downloaded.

I hope this will help a little to make video better for all.

Jorrit’s picture

I will try to add this in a next version, you're right that it is missing. It will not be the next version, because I intend to release it soon, but the one after that.

broncomania’s picture

I think now it would be better not to rename the file with the prefix qt- this could cause maybe problems with the update of the video module. So I think it would be better to make a tmp copy and delete te converted video so that qt-faststart can use the given name. I work on it right now. So it will be seemless for further improvements like qt.faststart check or similar. I will post my code here later.

broncomania’s picture

This is now my version without filename changes. Tested and working for me.

    // qt-faststart
    $qt_faststart_file = $this->settings['base_url'] . '/qt-' . $this->settings['filename'];
    file_unmanaged_copy(drupal_realpath($output_file), drupal_realpath($qt_faststart_file), FILE_EXISTS_REPLACE);
    file_unmanaged_delete(drupal_realpath($output_file));
    $qt_faststart_cmd = 'qt-faststart '. drupal_realpath($qt_faststart_file) . ' '.drupal_realpath($output_file);
    exec($qt_faststart_cmd); 
    file_unmanaged_delete(drupal_realpath($qt_faststart_file));
broncomania’s picture

This is qt-faststart implemtation of the video 2.5 version for all who needs this.

Add this code in the TranscoderAbstractionFactoryFfmpeg.inc after $output_file_rp = drupal_realpath($output_file); in line 226

    // qt-faststart
    $qt_faststart_file = drupal_realpath($this->settings['base_url'] . '/qt-' . $this->settings['filename']);
    file_unmanaged_copy($output_file_rp, $qt_faststart_file), FILE_EXISTS_REPLACE);
    file_unmanaged_delete($output_file_rp);
    $qt_faststart_cmd = 'qt-faststart '. $qt_faststart_file . ' '.$output_file_rp;
    exec($qt_faststart_cmd); 
    file_unmanaged_delete($qt_faststart_file);
Jorrit’s picture

This probably works, but it doesn't check if the file is an MP4 file. Qt-faststart should not be invoked for FLV, WebM or Ogg Theora files for instance.

broncomania’s picture

Ah thx for the information. I didn't know that and there is a small mistake in the code.
So is it enough for checking the file ending (.mp4)? Maybe it should be placed in an own function that also checks if it is a usable codec and offers the ability to extend it or for further debugging and developing?

    // qt-faststart
    $qt_faststart_file = drupal_realpath($this->settings['base_url'] . '/qt-' . $this->settings['filename']);
    file_unmanaged_copy($output_file_rp, $qt_faststart_file, FILE_EXISTS_REPLACE);
    file_unmanaged_delete($output_file_rp);
    $qt_faststart_cmd = 'qt-faststart '. $qt_faststart_file . ' '.$output_file_rp;
    exec($qt_faststart_cmd);
    file_unmanaged_delete($qt_faststart_file);
Jorrit’s picture

Status: Active » Fixed

Fixed in 7.x-2.x-dev. Please try the next -dev release, which will be available within 12 hours. Thanks for your patience.

Status: Fixed » Closed (fixed)

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