Recherche avancée

Médias (1)

Mot : - Tags -/Christian Nold

Autres articles (103)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (9599)

  • Using dragonfly and ffmpeg to process a video in Rails

    26 novembre 2015, par Maikell

    I am writing a Ruby on Rails 4 Web application, that gives the user an image-upload functionality. For this I followed this tutorial, which is using the gems

    dragonfly
    jquery-fileupload-rails
    remotipart

    This is working fine.
    Now I want to extend the image-upload functionality, to upload videos as well. But unfortunately I’m stuck with it. Here is what I have tried so far :

    config/initializers/dragonfly.rb

    require 'dragonfly'

    # Configure
    Dragonfly.app.configure do
     plugin :imagemagick

     secret 'd045734b043b4383a246c5c8daf2d3e31217dc8b030f21861e4fd16c4b72d382'

     url_format '/media/:job/:name'

     datastore :file,
               root_path: Rails.root.join('uploads/images/'),
               server_root: Rails.root.join('uploads')
    end

    Dragonfly.app(:videos).configure do
     secret 'd045734b043b4383a246c5c8daf2d3e31217dc8b030f21861e4fd16c4b72d382'

     url_format "/media/:job/:name"

     datastore :file,
               root_path: Rails.root.join('uploads/videos/'),
               server_root: Rails.root.join('uploads')
    end

    # Logger
    Dragonfly.logger = Rails.logger

    # Mount as middleware
    Rails.application.middleware.use Dragonfly::Middleware

    # Add model functionality
    if defined?(ActiveRecord::Base)
     ActiveRecord::Base.extend Dragonfly::Model
     ActiveRecord::Base.extend Dragonfly::Model::Validations
    end

    models/video.rb

    class Video < ActiveRecord::Base
     dragonfly_accessor :video, app_name: :videos do
       storage_options do |video|
         { path: "videos/#{Video.gen_uuid}-#{video.name}.webm" }
       end
     end
    end

    I upload the video with ajax. It is succesfully saved in the systems /tmp-directory. Than in the video-controller I call

    @video = Video.new[video_params]
    @video.save

    Now the video-params are correctly saved in the database, but the video is not saved in the given directory /uploads/videos Also my goal is, to process the video with ffmpeg, to convert it to a webm. ffmpeg is installed in the system and converting a video on the command line works fine.

    • But how do I get dragonfly to start the conversion process and save the video in the rails project ? Where do I have to put the ffmpeg-commands to dragonfly ?
    • Why does dragonfly not save the video in the directory uploads/videos ?

    Everything works fine with images and imagemagick. Only videos are causing problems.

  • Issue when combining 2 video files [after matching the specs]

    6 décembre 2015, par Rune

    Basically I got a .mp4 and a .flv file which I want to concatenate (the .mp4 should be the intro).

    So after having asked a previous question regarding this I went ahead and converted the intro video to an .flv with matching specifications of the second video.

    First I got the specifications of the second (.flv) video using ffprobe. This was the output :

    {
       "streams": [
           {
               "index": 0,
               "codec_name": "h264",
               "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
               "profile": "High",
               "codec_type": "video",
               "codec_time_base": "1/50",
               "codec_tag_string": "[0][0][0][0]",
               "codec_tag": "0x0000",
               "width": 646,
               "height": 364,
               "coded_width": 656,
               "coded_height": 368,
               "has_b_frames": 2,
               "sample_aspect_ratio": "1:1",
               "display_aspect_ratio": "323:182",
               "pix_fmt": "yuv420p",
               "level": 30,
               "chroma_location": "left",
               "refs": 5,
               "is_avc": "true",
               "nal_length_size": "4",
               "r_frame_rate": "25/1",
               "avg_frame_rate": "25/1",
               "time_base": "1/1000",
               "start_pts": 80,
               "start_time": "0.080000",
               "bit_rate": "400000",
               "bits_per_raw_sample": "8",
               "disposition": {
                   "default": 0,
                   "dub": 0,
                   "original": 0,
                   "comment": 0,
                   "lyrics": 0,
                   "karaoke": 0,
                   "forced": 0,
                   "hearing_impaired": 0,
                   "visual_impaired": 0,
                   "clean_effects": 0,
                   "attached_pic": 0
               }
           },
           {
               "index": 1,
               "codec_name": "aac",
               "codec_long_name": "AAC (Advanced Audio Coding)",
               "profile": "LC",
               "codec_type": "audio",
               "codec_time_base": "1/44100",
               "codec_tag_string": "[0][0][0][0]",
               "codec_tag": "0x0000",
               "sample_fmt": "fltp",
               "sample_rate": "44100",
               "channels": 2,
               "channel_layout": "stereo",
               "bits_per_sample": 0,
               "r_frame_rate": "0/0",
               "avg_frame_rate": "0/0",
               "time_base": "1/1000",
               "start_pts": 241,
               "start_time": "0.241000",
               "bit_rate": "96000",
               "disposition": {
                   "default": 0,
                   "dub": 0,
                   "original": 0,
                   "comment": 0,
                   "lyrics": 0,
                   "karaoke": 0,
                   "forced": 0,
                   "hearing_impaired": 0,
                   "visual_impaired": 0,
                   "clean_effects": 0,
                   "attached_pic": 0
               }
           }
       ],
       "format": {
           "filename": "vid2.flv",
           "nb_streams": 2,
           "nb_programs": 0,
           "format_name": "flv",
           "format_long_name": "FLV (Flash Video)",
           "start_time": "0.080000",
           "duration": "371.920000",
           "size": "23876671",
           "bit_rate": "513587",
           "probe_score": 100,
           "tags": {
               "audiosize": "4476626",
               "canSeekToEnd": "true",
               "datasize": "23876671",
               "videosize": "19004263",
               "hasAudio": "true",
               "hasCuePoints": "false",
               "hasKeyframes": "true",
               "hasMetadata": "true",
               "hasVideo": "true",
               "lasttimestamp": "372",
               "metadatacreator": "flvtool++ (Facebook, Motion project, dweatherford)",
               "totalframes": "9298",
               "encoder": "Lavf56.36.100"
           }
       }
    }

    Here’s my command :

    -i prefix.mp4 -b:v 400k -b:a 96k -r 25 -ar 44100 -acodec aac -vf scale=646:364 -strict -2 prefix.flv.

    This produces the following output (as well as the video file) :

    ffmpeg version N-76137-gb0bb1dc Copyright (c) 2000-2015 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-lzma --enable-decklink --enable-zlib
     libavutil      55.  4.100 / 55.  4.100
     libavcodec     57.  7.100 / 57.  7.100
     libavformat    57.  8.102 / 57.  8.102
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6. 12.100 /  6. 12.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.100 /  2.  0.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'prefix.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.8.102
     Duration: 00:00:05.31, start: 0.000000, bitrate: 1589 kb/s
       Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1205 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
    Output #0, flv, to 'prefix.flv':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf57.8.102
       Stream #0:0(und): Video: flv1 (flv) ([2][0][0][0] / 0x0002), yuv420p, 646x364 [SAR 2912:2907 DAR 16:9], q=2-31, 400 kb/s, 25 fps, 1k tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.7.100 flv
       Stream #0:1(und): Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, 5.1, fltp, 96 kb/s (default)
       Metadata:
         handler_name    : SoundHandler
         encoder         : Lavc57.7.100 aac
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> flv1 (flv))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    frame=   79 fps=0.0 q=10.7 size=     381kB time=00:00:03.43 bitrate= 908.7kbits/frame=  132 fps=0.0 q=10.1 Lsize=     548kB time=00:00:05.31 bitrate= 844.1kbits/s
    video:479kB audio:62kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.161623%
    [aac @ 0000021aa893eae0] Qavg: 177.292

    I then run the outputted video file and it runs just like the old one.

    I then concatenate the ouputted intro file with my main video file using the following command (tmp.txt contains the 2 files) :

    -f concat -i tmp.txt -c copy newvid.flv

    This produces the following output :

    ffmpeg version N-76137-gb0bb1dc Copyright (c) 2000-2015 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-lzma --enable-decklink --enable-zlib
     libavutil      55.  4.100 / 55.  4.100
     libavcodec     57.  7.100 / 57.  7.100
     libavformat    57.  8.102 / 57.  8.102
     libavdevice    57.  0.100 / 57.  0.100
     libavfilter     6. 12.100 /  6. 12.100
     libswscale      4.  0.100 /  4.  0.100
     libswresample   2.  0.100 /  2.  0.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, concat, from 'tmp.txt':
     Duration: N/A, start: 0.000000, bitrate: 496 kb/s
       Stream #0:0: Video: flv1, yuv420p, 646x364, 400 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
       Stream #0:1: Audio: aac (LC), 44100 Hz, 5.1, fltp, 96 kb/s
    [flv @ 00000257b5f0e180] Codec for stream 0 does not use global headers but container format requires global headers
    [flv @ 00000257b5f0e180] Codec for stream 1 does not use global headers but container format requires global headers
    Output #0, flv, to 'newvid.flv':
     Metadata:
       encoder         : Lavf57.8.102
       Stream #0:0: Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 646x364, q=2-31, 400 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
       Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, 5.1, 96 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [flv @ 00000257b56947e0] Packet mismatch 486539264 7424
    [flv @ 00000257b56947e0] Auto-inserting h264_mp4toannexb bitstream filter
    [flv @ 00000257b5f0e180] Non-monotonous DTS in output stream 0:0; previous: 5263, current: 5255; changing to 5263. This may result in incorrect timestamps in the output file.
    frame= 6359 fps=0.0 q=-1.0 size=   15906kB time=00:04:14.30 bitrate= 512.4kbits/frame= 9428 fps=0.0 q=-1.0 Lsize=   23835kB time=00:06:17.05 bitrate= 517.8kbits/s
    video:19016kB audio:4403kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.777447%

    When I try to run the final video (newvid.flv) it plays like this :

    It starts off playing the intro just fine.
    However, when the intro is finished the video freezes while the sound of the actual video continues for the entire duration of the video.

    Thus in conclusion what is lacking is the video of the second vid (the audio is fine).

    I’m new at using ffmpeg but I’ve tried my best to solve this, which is why I’m asking for your help.

    I’d certainly appreciate if someone could help me out.

  • How can I efficient process a video on a per-request basis ?

    18 décembre 2015, par mipadi

    I’m working on a web application in which a watermark must be applied to a video before it is sent to the user. Currently this watermark is static, and is created using ffmpeg when a video is updated. However, the application is changing so that a unique watermark will be added to the video for every request made for the video. This prevents a problem, as the video files may be fairly large and adding a watermark may be time-consuming (e.g., in some cases it may take over a minute to add a watermark), but the watermarks cannot be added on upload.

    I figured that streaming video could be a solution and implemented a solution using the nginx-rtmp-module, but several problems cropped up :

    1. RTMP solutions are a no-go as they appear to require Flash. This application must be supported on devices that don’t support Flash at all, or don’t (and won’t) have it installed.
    2. I have considered using MPEG-DASH, but that enjoys only limited support. Namely, it is not supported on versions of Firefox targeted by the application, nor is it supported on iOS or some versions of Safari.
    3. I have considered HLS, but that enjoys even more limited support than MPEG-DASH.
    4. Regardless, I haven’t actually been able to get Dash.js (the reference player for MPEG-DASH streams) to work, although that may be due to an encoding issue, I’m not sure.

    I wondered if there is a better (perhaps simpler) solution to this problem ; perhaps streaming video isn’t the way to go at all ? Is there an efficient way to transcode a video file on-the-fly and start sending it to the browser quickly ?

    I am not against using solutions like node.js or other platforms/frameworks, and solutions can use HTML5 <video></video> if necessary.