Video Export Library, need help testing update for Windows

Hi hi, since I don't have a Windows machine, I need some help testing the Video Export library under Windows. If there's a volunteer, here's a beta version: https://github.com/hamoid/video_export_processing/issues/22#issuecomment-289227909

What's the issue: mp4 video files include important metadata at the end of the file. Under Windows, when you decide to quit your video exporting Processing sketch, it kills the video export process without giving it time to save the metadata, which produces corrupt video files. I made some changes so the video export process would be "nicely" told to end. But I don't know if it works, since it's the first time I use a library in a library (jna-4.4.0.jar and jna-platform-4.4.0.jar), and it gives me some warnings when exporting the library.

What to test: that, after installing the library and ffmpeg under Windows, the produced videos can be played.

Cheers :)

Comments

  • As I had already told you, the older version itself worked for me on Windows. So I have reason to believe that this new version will also work.

  • That means I need to find someone for who it did not work before :) What Windows version are you on?

    Also... maybe I broke it by trying to fix it :P

  • Windows 8.1.

    If you did break it trying to fix it, you can have multiple versions for the different OS's, though I admit I do not know how you'll make Processing understand so much.

  • Thanks for the fix and for reaching out for testers, @hamoid. I don't have a Windows system on hand here, but I hope you find someone who can confirm progression and not regression!

  • I can do some testing sometime this week @hamoid. I haven't used you library as yet but I get back to you if I have any questions. I have Win 10 x64

    Kf

  • edited March 2017

    @hamid

    I downloaded your library and I ran your basic.pde example few times. When I exit via 'q' or clicking on the x button of the window I get the following warning:

    Mar 29, 2017 8:50:35 PM java.util.prefs.WindowsPreferences
    WARNING: Could not open/create prefs root node Software\JavaSoft\Prefs at root 0x80000002. Windows RegCreateKeyEx(...) returned error code 5. C:\Users\Documents\Processing\libraries\VideoExport\examples\basic\processing-movie.mp4 saved.

    If I stop the sketch via Processing stop button, I do not get the last line.

    Notice the warning happens when I click start, not when I exit. Also I played the movies after they are created and I didn't have any problems. They played without any issues. I have attached the ffmpeg.txt file created under the sketch folder, in case you need it.

    Kf

    ffmpeg version N-77870-gb58cfa6 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 5.2.0 (GCC)
      configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
      libavutil      55. 13.100 / 55. 13.100
      libavcodec     57. 22.100 / 57. 22.100
      libavformat    57. 21.101 / 57. 21.101
      libavdevice    57.  0.100 / 57.  0.100
      libavfilter     6. 24.100 /  6. 24.100
      libswscale      4.  0.100 /  4.  0.100
      libswresample   2.  0.101 /  2.  0.101
      libpostproc    54.  0.100 / 54.  0.100
    Input #0, rawvideo, from 'pipe:':
      Duration: N/A, start: 0.000000, bitrate: 259200 kb/s
        Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 600x600, 259200 kb/s, 30 tbr, 30 tbn, 30 tbc
    [libx264 @ 0000023eda467dc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 0000023eda467dc0] profile High, level 3.1
    [libx264 @ 0000023eda467dc0] 264 - core 148 r2638 7599210 - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=15.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'C:\Users\Documents\Processing\libraries\VideoExport\examples\basic\processing-movie.mp4':
      Metadata:
        comment         : Exported using VideoExport for Processing - https://github.com/hamoid/VideoExport-for-Processing
        encoder         : Lavf57.21.101
        Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 600x600, q=-1--1, 30 fps, 15360 tbn, 30 tbc
        Metadata:
          encoder         : Lavc57.22.100 libx264
        Side data:
          unknown side data type 10 (24 bytes)
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    [swscaler @ 0000023eda476c60] Warning: data is not aligned! This can lead to a speedloss
    frame=   34 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   64 fps= 63 q=21.0 size=       2kB time=00:00:00.20 bitrate=  73.0kbits/s speed=0.197x    
    frame=   95 fps= 62 q=21.0 size=       8kB time=00:00:01.23 bitrate=  50.7kbits/s speed=0.806x    
    frame=  126 fps= 62 q=21.0 size=      15kB time=00:00:02.26 bitrate=  53.1kbits/s speed=1.11x    
    frame=  157 fps= 61 q=21.0 size=      22kB time=00:00:03.30 bitrate=  53.7kbits/s speed=1.29x    
    frame=  187 fps= 61 q=21.0 size=      28kB time=00:00:04.30 bitrate=  54.3kbits/s speed= 1.4x    
    frame=  199 fps= 59 q=-1.0 Lsize=      45kB time=00:00:06.56 bitrate=  56.5kbits/s speed=1.93x    
    video:43kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.337658%
    [libx264 @ 0000023eda467dc0] frame I:4     Avg QP: 1.57  size:   246
    [libx264 @ 0000023eda467dc0] frame P:182   Avg QP:25.02  size:   225
    [libx264 @ 0000023eda467dc0] frame B:13    Avg QP:20.45  size:   144
    [libx264 @ 0000023eda467dc0] consecutive B-frames: 91.0%  1.0%  0.0%  8.0%
    [libx264 @ 0000023eda467dc0] mb I  I16..4: 99.8%  0.0%  0.2%
    [libx264 @ 0000023eda467dc0] mb P  I16..4:  5.1% 11.9%  0.1%  P16..4:  1.0%  0.0%  0.0%  0.0%  0.0%    skip:81.9%
    [libx264 @ 0000023eda467dc0] mb B  I16..4:  1.0%  0.2%  0.0%  B16..8:  7.3%  0.0%  0.0%  direct: 0.6%  skip:90.9%  L0:41.9% L1:58.1% BI: 0.0%
    [libx264 @ 0000023eda467dc0] 8x8 transform intra:61.6% inter:26.4%
    [libx264 @ 0000023eda467dc0] coded y,uvDC,uvAC intra: 0.1% 2.1% 0.4% inter: 0.0% 0.2% 0.1%
    [libx264 @ 0000023eda467dc0] i16 v,h,dc,p: 98%  1%  1%  0%
    [libx264 @ 0000023eda467dc0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  8%  1% 91%  0%  0%  0%  0%  0%  0%
    [libx264 @ 0000023eda467dc0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 47% 25% 27%  0%  0%  0%  0%  0%  1%
    [libx264 @ 0000023eda467dc0] i8c dc,h,v,p: 66%  0% 34%  0%
    [libx264 @ 0000023eda467dc0] Weighted P-Frames: Y:0.0% UV:0.0%
    [libx264 @ 0000023eda467dc0] ref P L0: 27.0%  0.0% 59.2% 13.8%
    [libx264 @ 0000023eda467dc0] ref B L1: 99.9%  0.1%
    [libx264 @ 0000023eda467dc0] kb/s:52.80
    
  • When I ran the webcamSaving.pde example, if I press 'q' it creates the movie and it plays with no issues. But I get an error: NoSuchMethodError: You may be using a library that's incompatible with this version of Processing. This error is associated with the following highlighted line: videoExport.endMovie();

    This error doesn't happen if I exit using the x-button in the corner of the sketch nor if I stop the sketch via Processing's stop button. Movies play with no problem at all.

    Notice the warning I mentioned in the previous post is still there. I get another warning from the gstreamer but I have seen this warning before in the latest update from Processing when working with the webcam.

    I did also test the following examples: Interactive, internetVideo, MultipleMovies, usingPGraphics, withAudio and there was no issue.

    with the withAudio.pde example, I even exit the sketch half way and the video was good and shorter as expected. Sound was there and of the same magnitude as when you play the audio player.

    Let me know if you want to do any other test.

    Kf

  • At the end of the withAudio.pde example, you have this comment:

       Note: if you want to visualize sound and want to
       match the sound precisely, you should not do it
       on real time. It will get out of sync. Instead:
       1. Analize the sound in one Processing sketch. 
          Output a text file with the FFT and amplitude data.
       2. Produce the movie in a second sketch. This sketch
          loads the text file produced in the first step
          and outputs the right amount of frames to match
          the sound duration.
       By doing it like this it does not matter how fast
       or slow your second program is.
       I'll provide an example on the next library upgrade.
    

    Would you be able to provide an example doing this in a future release?

    Also could you comment advantages or disadvantages of suing saveFrame() vs. your library beside the obvious fact that for the former you need to stitch all the frames together using the Movie Maker tool? That is, if you know of any?

    Thank you for sharing this really coll lib btw !

    Kf

  • That obvious fact is very important - with his library you don't need to distribute the MovieMaker tool along with any program that creates movies.

  • edited March 2017

    @kfrajer Are you sure you're using version 17 of the library? Go check the library.properties files once again.

    UPDATE - If you check that, please also post the complete error message. Thanks!

  • edited March 2017

    That is one amazing and useful report @kfrajer :) Thank you!

    Ok, I fixed the java.util.prefs.WindowsPreferences and uploaded an update.

    Why this warning: I tried to save the location of ffmpeg somewhere where I could read it later. Java provides a mechanism for this, the Preferences object. But apparently it's broken in some versions: http://stackoverflow.com/questions/5354838/java-java-util-preferences-failing

    My solution was to figure out where the VideoExport library is located, and save a settings.json file there. In a way I prefer it, because you can see the file, you can change it and delete it if you wish. I hope this is cross-platform (the settings.json file should appear inside the library folder).

    The NoSuchMethodError I have to research still.

    If there's any issues please use https://github.com/hamoid/video_export_processing/issues I'll close 3 of those today.

    About what's the advantage: the Movie Maker is great, but I thought it would be great to be export video directly from my programs without further steps. It makes it a bit easier. Also, it produces h264 mp4 files. Does the MM create Quicktime?

  • Ah yes, I will add the sound in-sync visualization example soon :)

  • Let me get back to you in few hours. I can re-run the examples and I let you know. I have to say I do not record video at all in my projects. However, after seeing what it can do, I like it! I asked about saveframe just wondering if it was based on the same mechanism... calling the same functions. I can check later today if MM creates QuickTime. I am assuming quicktime is another format?

    One more thing @hamoid. I wasn't using the latest java version. Does it matter?

    @Lord_of_the_Galaxy I downloaded the library from the link provided so I would say yes, latest version. I will check later today when I am in my laptop again.

    Kf

  • Ok, then don't bother. Please give the complete error message.

  • @hamoid

    I can see now the json file. I think the only thing to keep in mind is that every time the library is installed, you will need to point to the ffmpeg file. Other than that, it is nice to be able to find this info promptly, not like anyone will need it anyways.

    I tested the library doing 'q'(when available), button x in window, stop button in Processing and ESC and I can confirm you don't get any more warnings. It also works with the webcam example. No issues at all anymore.

    Kf

  • Thank you again for testing @kfrajer !

    I see your point about reinstalling the library and having to specify the ffmpeg location again... I could save it in the home folder, but I'm not a fan of programs making my home folder full of stuff. A system folder my require requesting privileges. That's why I tried using the standard java way, but it's buggy apparently. If anyone has a good idea, I'll be happy to hear.

    I'll post the update now :)

  • It's now out, including an example to visualize audio.

    The example is more complex than others. It uses Minim to convert a sound file into a text file with FFT data, and then uses this FFT data to produce a video visualizing the audio frequencies.

    I'll clean up the example and explain things in more detail when I have time.

  • Thaxs @hamoid! I give it a try sometime in this coming week. Quick question. From your experience, is it possible to find out when a video ends playing? For example, if I want to display a message or change the state machine of my program?

    Kf

  • @hamoid I am having issues updating the videoExport library. Is the repo setup properly? When I try to install through Processing IDE' lib manager, I get the following error in message in the library's main dialog window:

    Could not find a library in the downloaded file.

    Kf

  • Thank you, I'll start another thread to ask why is that happening.

  • I am using v 0.1.8 on a Windows 10 x64 machine and am receiving the NoSuchMethodError when trying to endMovie in the examples. It does seem to complete the file creation, and the video will play back- but the error locks up my Processing 3.3 sketch and needs to be force-quit after that line.

  • @nbontrager that's not nice... I'm really going to have to install a VirtualBox and test on Windows myself. To avoid force quitting, did you try pressing the square stop button?

  • @nbontrager Are you sure that the NoSuchMethodError specifies that endMovie() doesn't exist? It might even be that some inner method doesn't exist. Can you please post the full stack trace (i.e. the full error message) here?

  • edited April 2017

    What code are you using? You can also test it using one of the provided examples that come with the VideoExport library. Provide full details please about error messages.

    I tested it using the basic.pde in Processing 3.3 and Video Export lib version 0.1.7 in Win 10 x64 and no problems here. Also ffmpeg-20160115 for Win64_static.

    Kf

Sign In or Register to comment.