Recherche avancée

Médias (3)

Mot : - Tags -/Valkaama

Autres articles (80)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Le plugin : Gestion de la mutualisation

    2 mars 2010, par

    Le plugin de Gestion de mutualisation permet de gérer les différents canaux de mediaspip depuis un site maître. Il a pour but de fournir une solution pure SPIP afin de remplacer cette ancienne solution.
    Installation basique
    On installe les fichiers de SPIP sur le serveur.
    On ajoute ensuite le plugin "mutualisation" à la racine du site comme décrit ici.
    On customise le fichier mes_options.php central comme on le souhaite. Voilà pour l’exemple celui de la plateforme mediaspip.net :
    < ?php (...)

Sur d’autres sites (4273)

  • H264 HW accelerated decoding in Android using stagefright library

    21 février 2014, par user3215358

    I`m trying to decode h264 video using HW with Stagefright library.

    i have used an example in here. Im getting decoded data in MedaBuffer. For rendering MediaBuffer->data() i tried AwesomeLocalRenderer in AwesomePlayer.cpp.

    but picture in screen are distorted

    Here is The Link of original and crashed picture.

    And also tried this in example`

    sp<metadata> metaData = mVideoBuffer->meta_data();
    int64_t timeUs = 0;
    metaData->findInt64(kKeyTime, &amp;timeUs);
    native_window_set_buffers_timestamp(mNativeWindow.get(), timeUs * 1000);
    err = mNativeWindow->queueBuffer(mNativeWindow.get(),
    mVideoBuffer->graphicBuffer().get(), -1);`
    </metadata>

    But my native code crashes. I can`t get real picture its or corrupted or it black screen.

    Please, I need Your help, What i'm doing wrong ?

    Thanks in Advance.

  • How can fix CalledProcessError : in ffmpeg

    7 décembre 2020, par Mario

    I hope someone can help to troubleshoot this problem. I'm trying to save the loss plots out of Keras in the form of the following animation.

    &#xA;&#xA;

    img

    &#xA;&#xA;

    but I have been facing the following error, and ultimately I can't save the animation :

    &#xA;&#xA;

    MovieWriter stderr:&#xA;[h264_v4l2m2m @ 0x55a67176f430] Could not find a valid device&#xA;[h264_v4l2m2m @ 0x55a67176f430] can&#x27;t configure encoder&#xA;Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height&#xA;&#xA;---------------------------------------------------------------------------&#xA;BrokenPipeError                           Traceback (most recent call last)&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in saving(self, fig, outfile, dpi, *args, **kwargs)&#xA;    229         try:&#xA;--> 230             yield self&#xA;    231         finally:&#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback)&#xA;   1155                             frame_number &#x2B;= 1&#xA;-> 1156                     writer.grab_frame(**savefig_kwargs)&#xA;   1157 &#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in grab_frame(self, **savefig_kwargs)&#xA;    383         self.fig.savefig(self._frame_sink(), format=self.frame_format,&#xA;--> 384                          dpi=self.dpi, **savefig_kwargs)&#xA;    385 &#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/figure.py in savefig(self, fname, transparent, **kwargs)&#xA;   2179 &#xA;-> 2180         self.canvas.print_figure(fname, **kwargs)&#xA;   2181 &#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs)&#xA;   2081                     bbox_inches_restore=_bbox_inches_restore,&#xA;-> 2082                     **kwargs)&#xA;   2083             finally:&#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/backends/backend_agg.py in print_raw(self, filename_or_obj, *args, **kwargs)&#xA;    445                 cbook.open_file_cm(filename_or_obj, "wb") as fh:&#xA;--> 446             fh.write(renderer._renderer.buffer_rgba())&#xA;    447 &#xA;&#xA;BrokenPipeError: [Errno 32] Broken pipe&#xA;&#xA;During handling of the above exception, another exception occurred:&#xA;&#xA;CalledProcessError                        Traceback (most recent call last)&#xA; in <module>&#xA;     17 print(f&#x27;{model_type.upper()} Train Time: {Timer} sec&#x27;)&#xA;     18 &#xA;---> 19 create_loss_animation(model_type, hist.history[&#x27;loss&#x27;], hist.history[&#x27;val_loss&#x27;], epoch)&#xA;     20 &#xA;     21 evaluate(model, trainX, trainY, testX, testY, scores_train, scores_test)&#xA;&#xA; in create_loss_animation(model_type, loss_hist, val_loss_hist, epoch)&#xA;     34 &#xA;     35     ani = matplotlib.animation.FuncAnimation(fig, animate, fargs=(l1, l2, loss, val_loss, title), repeat=True, interval=1000, repeat_delay=1000)&#xA;---> 36     ani.save(f&#x27;loss_animation_{model_type}_oneDataset.mp4&#x27;, writer=writer)&#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in save(self, filename, writer, fps, dpi, codec, bitrate, extra_args, metadata, extra_anim, savefig_kwargs, progress_callback)&#xA;   1154                             progress_callback(frame_number, total_frames)&#xA;   1155                             frame_number &#x2B;= 1&#xA;-> 1156                     writer.grab_frame(**savefig_kwargs)&#xA;   1157 &#xA;   1158         # Reconnect signal for first draw if necessary&#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/contextlib.py in __exit__(self, type, value, traceback)&#xA;     97                 value = type()&#xA;     98             try:&#xA;---> 99                 self.gen.throw(type, value, traceback)&#xA;    100             except StopIteration as exc:&#xA;    101                 # Suppress StopIteration *unless* it&#x27;s the same exception that&#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in saving(self, fig, outfile, dpi, *args, **kwargs)&#xA;    230             yield self&#xA;    231         finally:&#xA;--> 232             self.finish()&#xA;    233 &#xA;    234 &#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in finish(self)&#xA;    365     def finish(self):&#xA;    366         &#x27;&#x27;&#x27;Finish any processing for writing the movie.&#x27;&#x27;&#x27;&#xA;--> 367         self.cleanup()&#xA;    368 &#xA;    369     def grab_frame(self, **savefig_kwargs):&#xA;&#xA;~/anaconda3/envs/CR7/lib/python3.6/site-packages/matplotlib/animation.py in cleanup(self)&#xA;    409         if self._proc.returncode:&#xA;    410             raise subprocess.CalledProcessError(&#xA;--> 411                 self._proc.returncode, self._proc.args, out, err)&#xA;    412 &#xA;    413     @classmethod&#xA;&#xA;CalledProcessError: Command &#x27;[&#x27;/usr/bin/ffmpeg&#x27;, &#x27;-f&#x27;, &#x27;rawvideo&#x27;, &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;, &#x27;-s&#x27;, &#x27;720x720&#x27;, &#x27;-pix_fmt&#x27;, &#xA;&#x27;rgba&#x27;, &#x27;-r&#x27;, &#x27;5&#x27;, &#x27;-loglevel&#x27;, &#x27;error&#x27;, &#x27;-i&#x27;, &#x27;pipe:&#x27;, &#x27;-vcodec&#x27;, &#x27;h264&#x27;, &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;, &#x27;-b&#x27;, &#x27;800k&#x27;, &#x27;-y&#x27;, &#xA;&#x27;loss_animation_CNN_oneDataset.mp4&#x27;]&#x27; returned non-zero exit status 1.&#xA;</module>

    &#xA;&#xA;

    I tried to ignore the error by this answer but it seems it's not the case. I also checked similar case but its answer for getting a static git binary is not my cas as well since not especial converting PNG to MP4 !

    &#xA;&#xA;

    My code is as follows :

    &#xA;&#xA;

    plt.rcParams[&#x27;animation.ffmpeg_path&#x27;] = &#x27;/usr/bin/ffmpeg&#x27;&#xA;&#xA;def animate(i, data1, data2, line1, line2):&#xA;    temp1 = data1.iloc[:int(i&#x2B;1)]&#xA;    temp2 = data2.iloc[:int(i&#x2B;1)]&#xA;&#xA;    line1.set_data(temp1.index, temp1.value)&#xA;    line2.set_data(temp2.index, temp2.value)&#xA;&#xA;    return (line1, line2)&#xA;&#xA;&#xA;def create_loss_animation(model_type, data1, data2):&#xA;    fig = plt.figure()&#xA;    plt.title(f&#x27;Loss on Train &amp; Test&#x27;, fontsize=25)&#xA;    plt.xlabel(&#x27;Epoch&#x27;, fontsize=20)&#xA;    plt.ylabel(&#x27;Loss MSE for Sx-Sy &amp; Sxy&#x27;, fontsize=20)&#xA;    plt.xlim(min(data1.index.min(), data2.index.min()), max(data1.index.max(), data2.index.max()))&#xA;    plt.ylim(min(data1.value.min(), data2.value.min()), max(data1.value.max(), data2.value.max()))&#xA;&#xA;    l1, = plt.plot([], [], &#x27;o-&#x27;, label=&#x27;Train Loss&#x27;, color=&#x27;b&#x27;, markevery=[-1])&#xA;    l2, = plt.plot([], [], &#x27;o-&#x27;, label=&#x27;Test Loss&#x27;, color=&#x27;r&#x27;, markevery=[-1])&#xA;    plt.legend(loc=&#x27;center right&#x27;, fontsize=&#x27;xx-large&#x27;)&#xA;&#xA;    Writer = animation.writers[&#x27;ffmpeg&#x27;]&#xA;    writer = Writer(fps=5, bitrate=1800)&#xA;&#xA;    ani = matplotlib.animation.FuncAnimation(fig, animate, fargs=(data1, data2, l1, l2), repeat=True, interval=1000, repeat_delay=1000)&#xA;    ani.save(f&#x27;{model_type}.mp4&#x27;, writer=writer)&#xA;&#xA;# create datasets&#xA;x = np.linspace(0,150,50)&#xA;y1 = 41*np.exp(-x/20)&#xA;y2 = 35*np.exp(-x/50)&#xA;&#xA;my_data_number_1 = pd.DataFrame({&#x27;x&#x27;:x, &#x27;value&#x27;:y1}).set_index(&#x27;x&#x27;)&#xA;my_data_number_2 = pd.DataFrame({&#x27;x&#x27;:x, &#x27;value&#x27;:y2}).set_index(&#x27;x&#x27;)&#xA;&#xA;create_loss_animation(&#x27;test&#x27;, my_data_number_1, my_data_number_2)&#xA;

    &#xA;

  • Video concatenation puts sound out of sync

    9 août 2019, par mmorin

    (Cross-posted from Video Production, where the question received no answers and may be more technical than usual video production.)

    I have several MOV files from a DSLR camera. I concatenate them with directions from this thread :

    ffmpeg -safe 0 -f concat -i files_to_combine -vcodec copy -acodec copy temp.MOV

    where files_to_combine is :

    file ./DSC_0013.MOV
    ...
    file ./DSC_0019.MOV

    The result has image and sound in sync for the first clip and is out of sync by fractions of a second in the second clip, and out of sync by around a second for the last clip. It is probably related to this error from the log :

    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] Auto-inserting h264_mp4toannexb bitstream filter

    How can I trim the frames to the available sound stream, then concatenate the two videos ?

    The full log from the ffmpeg command is :

    ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
     built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1.3_1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags='-I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include -I/Library/Java/JavaVirtualMachines/adoptopenjdk-11.0.2.jdk/Contents/Home/include/darwin' --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libtesseract --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-videotoolbox --disable-libjack --disable-indev=jack --enable-libaom --enable-libsoxr
     libavutil      56. 22.100 / 56. 22.100
     libavcodec     58. 35.100 / 58. 35.100
     libavformat    58. 20.100 / 58. 20.100
     libavdevice    58.  5.100 / 58.  5.100
     libavfilter     7. 40.101 /  7. 40.101
     libavresample   4.  0.  0 /  4.  0.  0
     libswscale      5.  3.100 /  5.  3.100
     libswresample   3.  3.100 /  3.  3.100
     libpostproc    55.  3.100 / 55.  3.100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dc00e000] Auto-inserting h264_mp4toannexb bitstream filter
    Input #0, concat, from 'files_to_combine':
     Duration: N/A, start: -0.592000, bitrate: 36888 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080, 35352 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
       Metadata:
         handler_name    : SoundHandler
    Output #0, mov, to 'temp.MOV':
     Metadata:
       encoder         : Lavf58.20.100
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080, q=2-31, 35352 kb/s, 50 fps, 50 tbr, 50k tbn, 50k tbc
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s
       Metadata:
         handler_name    : SoundHandler
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82dd802200] Auto-inserting h264_mp4toannexb bitstream filter
    frame=41886 fps=547 q=-1.0 Lsize= 3789826kB time=00:13:58.75 bitrate=37014.8kbits/s speed=10.9x    
    video:3631879kB audio:157123kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.021759%

    Update (1 July 2019)

    I thought that the files had a problem at the beginning or at the end, so I
    trimmed one second from each end, but it still had the sound out of sync :

    FILES=files_to_combine
    OUTPUT=show2.MOV
    rm $FILES
    for i in 3 4 5 6 7 8 9; do
       rm ${i}.MOV
       duration=$(ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1  DSC_001${i}.MOV)
       trimmed=$(echo $duration - 1 | bc)
       ffmpeg -ss 1 -t $trimmed -i DSC_001${i}.MOV -vcodec copy -acodec copy ${i}.MOV
       echo file ./${i}.MOV >> $FILES
    done

    rm $OUTPUT
    ffmpeg -safe 0 -f concat -i $FILES -vcodec copy -acodec copy $OUTPUT

    When I trim a single file near the end, the sound and video do not seem out of sync :

    ffmpeg -ss 00:09:20 -t 20 -i DSC_0014.MOV -vcodec copy -acodec copy end.MOV

    When I concatenate only 30 seconds from each video, the result seems OK :

    FILES=files_to_combine
    OUTPUT=show2.MOV
    rm $FILES
    for i in 3 4 5 6 7 8 9; do
       rm ${i}.MOV
       duration=$(ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1  DSC_001${i}.MOV)
       start=$(echo $duration - 30 | bc)
       end=$(echo $duration - 1 | bc)
       ffmpeg -ss $start -t $end -i DSC_001${i}.MOV -vcodec copy -acodec copy ${i}.MOV
       echo file ./${i}.MOV >> $FILES
    done

    rm $OUTPUT
    ffmpeg -safe 0 -f concat -i $FILES -vcodec copy -acodec copy $OUTPUT

    This last concatenation gives this error multiple times :

    [mov @ 0x7fc3c7837400] Non-monotonous DTS in output stream 0:0; previous: 9080205, current: 9080200; changing to 9080206. This may result in incorrect timestamps in the output file.

    So I am guessing that the problem is small differences in timestamps that
    accumulate and become more noticeable with longer durations and the
    concatenation of multiple files.

    For reference, the DSLR that shot these clips is a Nikon D3300 and the result
    of ffprobe on one of the files is :

    $ ffprobe DSC_0017.MOV -hide_banner
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fab70003800] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fab70003800] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DSC_0017.MOV':
     Metadata:
       major_brand     : qt  
       minor_version   : 537331968
       compatible_brands: qt  niko
       creation_time   : 2019-06-12T23:52:37.000000Z
     Duration: 00:09:53.58, start: 0.000000, bitrate: 36843 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m/bt709/bt470m), 1920x1080, 35300 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc (default)
       Metadata:
         creation_time   : 2019-06-12T23:52:37.000000Z
       Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
       Metadata:
         creation_time   : 2019-06-12T23:52:37.000000Z

    Update (9 August 2019)

    I concatenated the files in iMovie and the sound and image are not as out of sync as with FFMPEG. Maybe iMovie aligns the timestamps at the end of each clip instead of concatenating the audio and image streams separately.

    I ran the concatenation again with the latest ffmpeg 4.1.4_1 on these files and others from the same camera. The audio and image are in sync in one case (the results lasts 46 minutes) out of sync in another (the result lasts 48 minutes).