<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Espen,<div><br></div><div>You do understand me correctly and I have this mostly working as you describe. It works for .mov files, though I haven't been successful with a flash video yet - I still get the solid black background with play arrow. I'm going to keep working on that.</div><div><br></div><div>I'm happy to share with p4a, though I haven't received anything but a 503 error at plone4artists.org for the last few weeks. Who should I get in touch with to share it?</div><div><br></div><div>Thanks,</div><div>Brayton</div><div><br><div><div>On Sep 24, 2009, at 12:52 AM, Espen Moe-Nilssen wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="Lucida Grande"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="Lucida Grande"><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="Lucida Grande"><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">If I understand this right and you got this to work:</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="'Lucida Grande'"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="'Lucida Grande'">1) Add a "p4video-file" to plone&nbsp;</font></div></span></span></span></span>2) The first frame of the image shows as the video/image.</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="'Lucida Grande'"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="Lucida Grande"><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">I am pretty sure the people behind p4artists would like that code....</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="'Lucida Grande'"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="'Lucida Grande'"><br></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font-family: Helvetica; "><font class="Apple-style-span" face="Lucida Grande"><span class="Apple-style-span" style="border-collapse: separate; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; -webkit-text-decorations-in-effect: none; text-indent: 0px; -webkit-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">Espen&nbsp;</span></font></div></span></span></span></span></span><br class="Apple-interchange-newline"></span><br class="Apple-interchange-newline"> </font></div><font class="Apple-style-span" face="Lucida Grande"></font></span></span></span></span></span></span></span></div><br><div><div>Den 23. sep. 2009 kl. 18.19 skrev Brayton Osgood:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Between this and IRC I've got the image capture working. Still have to write the captured image back into Plone, but I think I have that under control. Thanks for all the help,</div><div><br></div><div>Brayton</div><div><br></div><div>Here is the code I used (for future Googlers):</div><div><br></div><div><div>&nbsp;&nbsp;context = aq_inner(file)</div><div>&nbsp;&nbsp;movie_data = context.get_data()</div><div><br></div><div>&nbsp;&nbsp;movie_id, movie_name = tempfile.mkstemp('.mov',text=False)</div><div>&nbsp;&nbsp;image_id, image_name = tempfile.mkstemp('jpg', text=False)</div><div>&nbsp;&nbsp;output_id, output_name = tempfile.mkstemp()</div><div>&nbsp;&nbsp;wfile = open(movie_name, 'wb')</div><div>&nbsp;&nbsp;wfile.write(movie_data)</div><div>&nbsp;&nbsp;wfile.close()</div><div><br></div><div>&nbsp;&nbsp;args = "ffmpeg -i %s -ss 1 -an -vframes 1 -f image2 %s" % (movie_name, image_name)</div><div>&nbsp;&nbsp;p = sub.Popen(args, shell=True, stdin=sub.PIPE, stdout=output_name, stderr=sub.STDOUT)</div></div><div><br></div><br><div><div>On Sep 23, 2009, at 1:38 AM, Jean-Michel FRANCOIS wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"> <div bgcolor="#ffffff" text="#000000"> Tom Gross a écrit&nbsp;: <blockquote cite="mid:h9cgfj$c74$1@ger.gmane.org" type="cite">  <pre wrap="">Hi Brayton,

  p4a-video uses the File-content-type, which again uses OFS.File as
content-class. If you want to access the raw-data use:

atfileobject.getFile().data

or

str(atfileobject.getFile())

If you need a file-like object, you have to do:

stream = StringIO(str(atfileobject.getFile()))

HTH
-Tom


Brayton Osgood wrote:
  </pre>  <blockquote type="cite">    <pre wrap="">I'm trying to extend P4A Video to automatically generate the file images
that can be added to each video via the edit panel of any IVideoEnhanced
content. Ideally, the result will be an adapter (I think) that responds
to the IVideoEnhanced interface.

Right now I'm running into trouble capturing an image from a video file
once it's stored in Plone. I've tried calling ffmpeg as a subprocess,
but I get an I/O error (see below):

    </pre>    <blockquote type="cite">      <blockquote type="cite">        <blockquote type="cite">          <pre wrap="">image = subprocess.Popen('ffmpeg -i moviefile -ss 1 -an -vframes 1
          </pre>        </blockquote>      </blockquote>    </blockquote>    <pre wrap="">-f image2 thumb%2d.jpg', shell=True, stdin=subprocess.PIPE,
stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
    </pre>    <blockquote type="cite">      <blockquote type="cite">        <blockquote type="cite">          <pre wrap="">print image.stdout.read()
          </pre>        </blockquote>      </blockquote>    </blockquote>    <pre wrap="">FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et
al.
  configuration: --enable-gpl --enable-pp --enable-swscaler
--enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg
--     enable-libgsm --enable-dc1394 --disable-debug --enable-shared
--prefix=/usr
  libavutil version: 1d.49.3.0
  libavcodec version: 1d.51.38.0
  libavformat version: 1d.51.10.0
  built on Mar 16 2009 21:19:49, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3)
moviefile: I/O error occured
Usually that means that input file is truncated and/or corrupted.

I've tried doing this where 'moviefile' is an &lt;ATFile at
/Plone/Members/brayt/jumping2.mov&gt; object, a &lt;p4a.video _ATCTFileVideo&gt;
object (applying the IVideo interface to the ATFile), and even the
binary data (passed by moviefile.getData()). Each case gives me the same
error.

I suspect this is because ffmpeg expects to receive certain file types,
and Plone files are somehow wrapped so they aren't recognized. I guess
my question may boil down to how do I access (and do something useful
with) the data in a file that's not normally read by Plone? I suspect
that the indexing of PDFs behaves similarly to what I'm hoping to do,
but I haven't quite figured out how that works.

Any help would be greatly appreciated!

Thanks much,

Brayton
    </pre>  </blockquote>  <pre wrap=""><!---->

_______________________________________________
Product-Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Product-Developers@lists.plone.org">Product-Developers@lists.plone.org</a>
<a class="moz-txt-link-freetext" href="http://lists.plone.org/mailman/listinfo/product-developers">http://lists.plone.org/mailman/listinfo/product-developers</a>
  </pre> </blockquote> To call it with subprocess :<br> - use mkstemp python module to create a temp file<br> - write the raw data inside it<br> - do the subprocess on that new tempfile<br> - don't forget to delete the temp file<br> - write the image inside your image field.<br> <br> <pre class="moz-signature" cols="80">-- 
Cordialement,
Jean-Michel FRANCOIS
Makina-Corpus</pre></div></blockquote></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">_______________________________________________</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Product-Developers mailing list</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="mailto:Product-Developers@lists.plone.org">Product-Developers@lists.plone.org</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><a href="http://lists.plone.org/mailman/listinfo/product-developers">http://lists.plone.org/mailman/listinfo/product-developers</a></div> </blockquote></div><br></div></blockquote></div><br></div></body></html>