Recherche avancée

Médias (3)

Mot : - Tags -/image

Autres articles (44)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Installation en mode ferme

    4 février 2011, par

    Le mode ferme permet d’héberger plusieurs sites de type MediaSPIP en n’installant qu’une seule fois son noyau fonctionnel.
    C’est la méthode que nous utilisons sur cette même plateforme.
    L’utilisation en mode ferme nécessite de connaïtre un peu le mécanisme de SPIP contrairement à la version standalone qui ne nécessite pas réellement de connaissances spécifique puisque l’espace privé habituel de SPIP n’est plus utilisé.
    Dans un premier temps, vous devez avoir installé les mêmes fichiers que l’installation (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (8901)

  • Programmatically terminate ffmpeg child process on Raspberry Pi

    16 août 2020, par McGuireV10

    Is it possible to cleanly terminate ffmpeg when it's running as a child process under Linux (specifically on a Raspberry Pi 4B) ? I have a .NET Core 3.1 application which spawns ffmepg with the following command, which should encode an h.264 stream to an MP4 file :

    


    ffmpeg -framerate 24 -i - -b:v 2500k -c copy video.mp4


    


    After some arbitrary period of time I want to terminate ffmpeg, but everything I try is either ignored or causes ffmpeg to exit immediately — it never writes the MOOV chunk to the end of the MP4 file, which results in a corrupted file that cannot be played. I realize this chunk can take awhile to generate, and I've tried leaving the process alone for up to 60 seconds, which is far longer than h.264 to MP4 encoding requires interactively on the same device. For the record, I know how to create a "fragmented" MP4 which is mostly playable (using the -movflags switch and others), but I'm trying to generate a correct MP4.

    


    I've tried sending a Q key with or without various CR+LF combos, which I've seen mentioned in similar questions, but I think that's a Windows-only thing.

    


    I've tried every Unix signal as well as combinations of two signals. I saw somewhere (I think the ffmpeg site itself) that SIGINT should be sent twice, but that does nothing. In another SO post, somebody suggested sending SIGQUIT which also does nothing. Interestingly, sending SIGINT followed by SIGQUIT is the only combination that actually terminates the process, but it ends immediately with the following output :

    


    Error writing trailer of /media/ramdisk/video.mp4: Immediate exit requested
frame=  236 fps= 29 q=-1.0 Lsize=   28928kB time=00:00:09.79 bitrate=24201.9kbits/s speed= 1.2x
video:29167kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Exiting normally, received signal 2.


    


    I've tried a long delay between the two, nothing happens until the SIGQUIT at which point it responds as shown above. Oddly, sometimes it says received signal 3 instead of 2.

    


    There has to be some trick I'm missing.

    


  • About the delay of Electron playing FFpmeg transcoded video

    26 juillet 2020, par Yohann

    In the Electron project, you need to try to play the video screen of the camera

    


    The camera is Haikang’s webcam

    


    Get real-time video stream through RTSP protocol

    


    rtsp://admin:admin@192.168.0.253/main/Channels/

    


    There will be a delay of about 3s when playing through the VLC player

    


    Then when used in the project, create a websocket service in Electron through the main process, decode the rtsp video through fluent-ffmpeg, and convert it to flv stream and push it to the rendering process

    


    import * as express from 'express'
import * as expressWebSocket from 'express-ws'
import ffmpeg from 'fluent-ffmpeg'
import webSocketStream from 'websocket-stream/stream'
const path = require('path')

let ffmpegPath
if (process.env.NODE_ENV === 'development') {
  ffmpegPath = path.join(__static, 'ffmpeg', 'bin', 'ffmpeg.exe')
} else {
  ffmpegPath = path.join(process.cwd(), 'ffmpeg', 'bin', 'ffmpeg.exe')
}
ffmpeg.setFfmpegPath(ffmpegPath)

// Start video transcoding service
function videoServer () {
  let app = express()
  app.use(express.static(__dirname))
  expressWebSocket(app, null, {
    perMessageDeflate: true
  })
  app.ws('/rtsp/', rtspRequestHandle)
  app.listen(8888)
  console.log('Create a monitoring service')
}

//RTSP transcoding method
function rtspRequestHandle (ws, req) {
  console.log('rtsp request handle')
  const stream = webSocketStream(ws, {
    binary: true,
    browserBufferTimeout: 1000000
  },
  {
    browserBufferTimeout: 1000000
  })
  let url = req.query.url
  console.log('rtsp url:', url)
  try {
    ffmpeg(url)
      .addInputOption('-rtsp_transport', 'tcp', '-buffer_size', '102400') // Here you can add some RTSP optimized parameters
      .outputOptions([
        '-fflags',
        'nobuffer',
        '-tune',
        'zerolatency'
      ])
      .on('start', function () {
        console.log(url, 'Stream started.')
      })
      .on('codecData', function () {
        console.log(url, 'Stream codecData.')
      })
      .on('error', function (err) {
        console.log(url, 'An error occured: ', err.message)
      })
      .on('end', function () {
        console.log(url, 'Stream end!')
      })
      .outputFormat('flv').videoCodec('copy').noAudio().pipe(stream)
  } catch (error) {
    console.log(error)
  }
}

export default videoServer


    


    The rendering process parses the video stream and plays the video through flv.js

    


    <template>&#xA;  <div class="video">&#xA;    <video class="video-box" ref="player"></video>&#xA;  </div>&#xA;</template>&#xA;&#xA;<code class="echappe-js">&lt;script&gt;&amp;#xA;  import flvjs from &amp;#x27;flv.js&amp;#x27;&amp;#xA;  export default {&amp;#xA;    name: &amp;#x27;videopage&amp;#x27;,&amp;#xA;    props: {&amp;#xA;      rtsp: String&amp;#xA;    },&amp;#xA;    data () {&amp;#xA;      return {&amp;#xA;        player: null&amp;#xA;      }&amp;#xA;    },&amp;#xA;    mounted () {&amp;#xA;      console.log(flvjs.isSupported())&amp;#xA;      if (flvjs.isSupported()) {&amp;#xA;        let video = this.$refs.player&amp;#xA;        console.log(video)&amp;#xA;        if (video) {&amp;#xA;          this.player = flvjs.createPlayer({&amp;#xA;            type: &amp;#x27;flv&amp;#x27;,&amp;#xA;            isLive: true,&amp;#xA;            url: &amp;#x27;ws://localhost:8888/rtsp/?url=&amp;#x27; &amp;#x2B; this.rtsp&amp;#xA;          }, {&amp;#xA;            enableStashBuffer: true&amp;#xA;          })&amp;#xA;          console.log(this.player)&amp;#xA;          this.player.attachMediaElement(video)&amp;#xA;          try {&amp;#xA;            this.player.load()&amp;#xA;            this.player.play()&amp;#xA;          } catch (error) {&amp;#xA;            console.log(error)&amp;#xA;          }&amp;#xA;        }&amp;#xA;      }&amp;#xA;    },&amp;#xA;    methods: {&amp;#xA;      getCurrentFrame () {&amp;#xA;        let video = this.$refs.player&amp;#xA;        let scale = 1&amp;#xA;        let canvas = document.createElement(&amp;#x27;canvas&amp;#x27;)&amp;#xA;        canvas.width = video.videoWidth * scale&amp;#xA;        canvas.height = video.videoHeight * scale&amp;#xA;        canvas.getContext(&amp;#x27;2d&amp;#x27;).drawImage(video, 0, 0, canvas.width, canvas.height)&amp;#xA;        return canvas.toDataURL(&amp;#x27;image/png&amp;#x27;)&amp;#xA;      }&amp;#xA;    },&amp;#xA;    beforeDestroy () {&amp;#xA;      this.player &amp;amp;&amp;amp; this.player.destory &amp;amp;&amp;amp; this.player.destory()&amp;#xA;    }&amp;#xA;  }&amp;#xA;&lt;/script&gt;&#xA;&#xA;&#xA;

    &#xA;

    Then there will be a delay of about 3s when playing, and the delay will increase with the playing time

    &#xA;

    There will be a delay of 10 minutes in the later period

    &#xA;

    Is there any way to control this delay time

    &#xA;

    Or is there any other decoding scheme that can be used ?

    &#xA;

    Solutions that can support electron

    &#xA;

  • FFmpeg continues to process after time specified at "-to"

    4 août 2020, par Yamahabest

    I have a video, where I want to cut a part from the beginning, and from the end. And I want to apply some fade ins/fade outs, and add some text.

    &#xA;

    So, I came up with the following syntax :

    &#xA;

    -ss 10 -to 40 &#xA;-i "D:\DATA\Software\VideoProcessor_Files\20171015 Zelhem Tandem Frans met Mirthe.MP4" &#xA;-loop 1 -i "Input_Files\logo maurik large.png" &#xA;-loop 1 -i "Input_Files\logo maurik small.png" &#xA;-filter_complex "&#xA;    color=0x7F7F7F@0.95:1920x1080[grey_for_fade_out];&#xA;    [grey_for_fade_out]fade=t=out:st=12:d=2:alpha=1[grey_fade_out];&#xA;    [0:v][grey_fade_out]overlay[video_grey_fade_out];&#xA;    color=0x7F7F7F@0.95:1920x1080[grey_for_fade_in];&#xA;    [grey_for_fade_in]fade=t=in:st=37:d=2:alpha=1[grey_fade_in];&#xA;    [video_grey_fade_out][grey_fade_in]overlay[video_grey_fade_out_in];&#xA;    [1:v]fade=t=out:st=13:d=2:alpha=1[over];&#xA;    [over]scale=iw/1.5:-1[scaled];&#xA;    [video_grey_fade_out_in][scaled]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/10[video_grey_fade_out_in_logo];&#xA;    [1:v]fade=t=in:st=36:d=2:alpha=1[over2];&#xA;    [over2]scale=iw/1.5:-1[scaled2];&#xA;    [video_grey_fade_out_in_logo][scaled2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[video_grey_fade_out_in_logo2];&#xA;    [2:v]colorchannelmixer=aa=0.5,fade=t=in:st=14:d=2:alpha=1,fade=t=out:st=35:d=2:alpha=1[over3];&#xA;    [over3]scale=iw/10:-1[scaled3];&#xA;    [video_grey_fade_out_in_logo2][scaled3]overlay=10:10[video_complete];&#xA;    [video_complete]drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text=&#x27;Tandemvlucht met Mirthe&#x27;:fontsize=96:fontcolor=white:alpha=&#x27;if(lt(t,11),1,(2-(t-11))/2)&#x27;:x=(w-text_w)/2:y=((h-text_h)/2)&#x2B;125,drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text=&#x27;Zeddam&#x27;:fontsize=96:fontcolor=white:alpha=&#x27;if(lt(t,11),1,(2-(t-11))/2)&#x27;:x=(w-text_w)/2:y=((h-text_h)/2)&#x2B;250,drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text=&#x27;4 augustus 2020&#x27;:fontsize=96:fontcolor=white:alpha=&#x27;if(lt(t,11),1,(2-(t-11))/2)&#x27;:x=(w-text_w)/2:y=((h-text_h)/2)&#x2B;375,drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text=&#x27;Ook een keer meevliegen?&#x27;:fontsize=96:fontcolor=white:alpha=&#x27;if(lt(t,37),0,(t-37)/2)&#x27;:x=(w-text_w)/2:y=((h-text_h)/6),drawtext=fontfile=Input_Files/Sansation-Bold.ttf:text=&#x27;Of bel 085 - 049 55 69&#x27;:fontsize=96:fontcolor=white:alpha=&#x27;if(lt(t,37),0,(t-37)/2)&#x27;:x=(w-text_w)/2:y=((h-text_h)/2)&#x2B;350"&#xA;-preset medium &#xA;-crf 18 &#xA;-c:a copy &#xA;-y ".\Output_Files\Video\Zeddam\2020-08-04\Mirthe\27ed390a-8497-4550-b93f-4f87d9f2c9f0\MP_Tandemvlucht met_Mirthe_Zeddam_2020-08-04.mp4"&#xA;

    &#xA;

    I am quite sure this has worked in the past, but now FFmpeg just keeps on processing endlessly. If I then stop the FFmpeg process, and look at the resulting file, I see that the last frame (of the end of the specified period) just keeps on duplicating.

    &#xA;

    The drop counter in the console output of FFmpeg also starts increasing at the end of the specified period :

    &#xA;

    frame=  987 fps= 15 q=-1.0 Lsize=   31357kB time=00:00:41.04 bitrate=6259.0kbits/s dup=0 drop=10 speed=0.644x&#xA;

    &#xA;

    I am kind of lost on why this doesn't work anymore. I might have upgraded the FFmpeg executable in the mean time. Maybe my syntax was/is not correct, but I believe it just worked.

    &#xA;

    It has to be in the complex filter, because when I remove that, it works alright.&#xA;It is not in the drawtext part of the complex filter, because it still occurs when I remove that. And when I only do the drawtext, FFmpeg stops correctly at the specified time.

    &#xA;

    I have tried this, but then it still occurs :

    &#xA;

    -filter_complex "&#xA;    color=0x7F7F7F@0.95:1920x1080[grey_for_fade_out];&#xA;    [grey_for_fade_out]fade=t=out:st=12:d=2:alpha=1[grey_fade_out];&#xA;    [0:v][grey_fade_out]overlay[video_grey_fade_out];&#xA;    color=0x7F7F7F@0.95:1920x1080[grey_for_fade_in];&#xA;    [grey_for_fade_in]fade=t=in:st=37:d=2:alpha=1[grey_fade_in];&#xA;    [video_grey_fade_out][grey_fade_in]overlay"&#xA;

    &#xA;

    Also with this, it still occurs :

    &#xA;

    -filter_complex "&#xA;    [1:v]fade=t=out:st=13:d=2:alpha=1[over];&#xA;    [over]scale=iw/1.5:-1[scaled];&#xA;    [0:v][scaled]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/10[video_grey_fade_out_in_logo];&#xA;    [1:v]fade=t=in:st=36:d=2:alpha=1[over2];&#xA;    [over2]scale=iw/1.5:-1[scaled2];&#xA;    [video_grey_fade_out_in_logo][scaled2]overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2[video_grey_fade_out_in_logo2];&#xA;    [2:v]colorchannelmixer=aa=0.5,fade=t=in:st=14:d=2:alpha=1,fade=t=out:st=35:d=2:alpha=1[over3];&#xA;    [over3]scale=iw/10:-1[scaled3];&#xA;    [video_grey_fade_out_in_logo2][scaled3]overlay=10:10"&#xA;

    &#xA;

    I just don't understand. All my fade-ins/-outs seem to be within the specified range :

    &#xA;

      &#xA;
    • fade=t=out:st=12:d=2 : start at 12 seconds, duration 2 seconds. This ends at 14 seconds, which is smaller than 40 seconds.
    • &#xA;

    • fade=t=in:st=37:d=2 : start at 37 seconds, duration 2 seconds. This ends at 39 seconds, which is smaller than 40 seconds.
    • &#xA;

    • fade=t=out:st=13:d=2 : start at 13 seconds, duration 2 seconds. This ends at 15 seconds, which is smaller than 40 seconds.
    • &#xA;

    • fade=t=in:st=36:d=2 : start at 36 seconds, duration 2 seconds. This ends at 38 seconds, which is smaller than 40 seconds.
    • &#xA;

    &#xA;

    It is just like some sequence is not ended properly, which is causing FFmpeg to just continue.

    &#xA;