Is there a way in Rails to get the duration (minutes, seconds, etc.) of a flash video? I want to display the amount of time to the users before they start playing it or downloading it. I control the flash video and it is in my public directory. There are many video clips and they change frequently and I don''t want to have to look at them and store the length when I copy the file over. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 19 March 2011 16:47, Ralph Shnelvar <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Is there a way in Rails to get the duration (minutes, seconds, etc.) of > a flash video? I want to display the amount of time to the users before > they start playing it or downloading it.Do you know a way of determining the time via command line? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Saturday, March 19, 2011, 11:12:58 AM, you wrote: CL> On 19 March 2011 16:47, Ralph Shnelvar <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:>> Is there a way in Rails to get the duration (minutes, seconds, etc.) of >> a flash video? I want to display the amount of time to the users before >> they start playing it or downloading it.CL> Do you know a way of determining the time via command line? Colin, I do not know how to do so. I was hoping there was a gem to help me do it. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
The mediainfo CLI app, or ffmpeg if that doesn''t work. You can shell out to the CLI with the back-tick operator, and the return from either of these will be plain text, suitable for further regular-expression- bashing. Walter On Mar 19, 2011, at 2:30 PM, Ralph Shnelvar wrote:> Saturday, March 19, 2011, 11:12:58 AM, you wrote: > > CL> On 19 March 2011 16:47, Ralph Shnelvar <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >>> Is there a way in Rails to get the duration (minutes, seconds, >>> etc.) of >>> a flash video? I want to display the amount of time to the users >>> before >>> they start playing it or downloading it. > > CL> Do you know a way of determining the time via command line? > > Colin, I do not know how to do so. > > I was hoping there was a gem to help me do it. > > -- > You received this message because you are subscribed to the Google > Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails- > talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org > . > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en > . >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
For those who may need the answer to this question I will outline my OS-independent solution. The file format of an .flv file is documented in http://download.macromedia.com/f4v/video_file_format_spec_v10_1.pdf To spare you the effort of reading the documentation ... Read the metadata header into a string. Reading 10K should be way more than enough. Search for the string "duration" (without the quotes). "duration" is null terminated. The next 16 bytes are a double and can be interpreted as String.unpack("G"). The double so interpreted is the duration in seconds. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 19, 6:30 pm, Ralph Shnelvar <ral...-bVGy8FV858MAvxtiuMwx3w@public.gmane.org> wrote:> Saturday, March 19, 2011, 11:12:58 AM, you wrote: > > CL> On 19 March 2011 16:47, Ralph Shnelvar <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote: > > >> Is there a way in Rails to get the duration (minutes, seconds, etc.) of > >> a flash video? I want to display the amount of time to the users before > >> they start playing it or downloading it. > > CL> Do you know a way of determining the time via command line? > > Colin, I do not know how to do so. > > I was hoping there was a gem to help me do it.Have you checked the flvtool2 gem to see if that gets you what you need ? Katie -- http://www.coderstack.co.uk/python-developer-jobs -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.