Motion - Feature Request 2007x 07x 19x 131921

Feature Request: Video encoding to just FLV, instead of SWF

Description

I was delighted to notice that the newest version of Motion supports direct encoding to Flash video via FFmpeg. Something I have done long with my own scripts.

But why directly into SWF format? Plain Flash Video (FLV) would give administrator more options to display the encoded video. I have used open source Flash video player called Flow Player to view the videos. It has nice user interface with play/pause and a draggable seek bar.

I have used the following commands to do the encoding to FLV from MPEG4:

# Encode to 640 x 480 Flash video in 10 fps with no sound
$ ffmpeg -i INPUTVIDEOFILE -s 640x480 -ar 0 -r 10 OUTPUTVIDEOFILE.flv

# Make the Flash video seekable
$ cat OUTPUTVIDEOFILE.flv | flvtool2 -U stdin OUTPUTVIDEOFILE.flv

(Taken from Flow Player website)

Then the FLV file can be played using Flow Player like this:

  <object type="application/x-shockwave-flash" data="FlowPlayer.swf"
        width="640" height="502" id="FlowPlayer">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="FlowPlayer.swf" />
    <param name="quality" value="high" />
    <param name="scale" value="noScale" />
    <param name="wmode" value="transparent" />
    <param name="flashvars" value="config={videoFile: 'videofile.flv'}" />
  </object>

Feature proposal:

Add a new value to ffmpeg_video_codec option: flv.

Patch:

I am currently writing a patch to implement this feature. Let's see how it goes.

-- TimoTaskinen - 19 Jul 2007

By copying the SWF functionality, I managed to make FFmpeg encode .flv file which works with Flow Player. But two todos still:

  • Frame rate wrong. FLV file plays way too fast. I think FFmpeg defaults to 25 or so. I think in my setup the correct frame rate should be 10.
  • FLV file is missing hinting. So it is not seekable in Flow Player. Need to use flvtool2 (from http://www.inlet-media.de/flvtool2) afterwards:

cat OUTPUTVIDEOFILE.flv | flvtool2 -U stdin OUTPUTVIDEOFILE.flv

The flvtool2 command above add the video duration into the FLV's meta data. Flow Player reads the duration information from the FLV and displays it.

Meta data creation can be made easily by using on_movie_end option. This could be the easiest solution, since user still needs to obtain flvtool2 separately.

Patch (made against ffmpeg.c of the 3.2.8 release):

--- ffmpeg.c.original   2007-07-19 20:14:48.000000000 +0300
+++ ffmpeg.c    2007-07-19 19:07:26.000000000 +0300
@@ -187,6 +187,9 @@
        } else if (strcmp(codec, "swf") == 0) {
                ext = ".swf";
                of = guess_format("swf", NULL, NULL);
+       } else if (strcmp(codec, "flv") == 0) {
+               ext = ".flv";
+               of = guess_format("flv", NULL, NULL);
        } else {
                motion_log(LOG_ERR, 0, "ffmpeg_video_codec option value %s is not supported", codec);
                return NULL;

Follow up

Comments

would be nice if this is committed to svn.

-- BobSaggeth - 26 Sep 2007

Committed to svn r232.

-- AngelCarpintero - 13 Oct 2007

Any solution to the 'Frame rate wrong' as at present this produces totally unusable output flv files unfortunately.

-- AndyBrown - 29 Jan 2008

+1 to fixing this bug

-- AngelVera - 17 Mar 2009

Try extpipe that's already in trunk - more details here: http://www.lavrsen.dk/twiki/bin/view/Motion/DarkwindHackeronMotionPatching

-- RomanGaufman - 18 Mar 2009

FeatureRequestForm edit

TopicTitle Video encoding to just FLV, instead of SWF
FeatureRequestStatus Implemented
SubmittedBy TimoTaskinen
Topic revision: r9 - 18 Mar 2009, RomanGaufman
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.