Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (62)

Sur d’autres sites (13302)

  • Assigning variable a home file path returns warning

    28 mai 2015, par Code_Ed_Student

    I am working with ffmpeg and bash. The question that follows is more in relation to bash scripting variable assignment. I compiled ffmpeg from source using the guide. There are two ways to invoke ffmpeg : cd ~/bin && ./ffmpeg -i ~/input.mp4 ~/videos/output.mkv or /home/yourusername/bin/ffmpeg ... . However in my script I am trying to set path to a variable and it returns the error Using a password on the command line interface can be insecure. How can I properly call the program without this warning ?

    #!/bin/bash/
    ffprobe_path="/home/yourusername/bin/ffprobe"

    while IFS== read field value; do
       details[$field]="$value"
    done < <($ffprobe_path -i "$file" -show_format -v quiet | grep '.=.')

    echo "${details[duration]}"

    Result

    Warning: Using a password on the command line interface can be insecure.
  • How do IP camera stream video across home network

    22 janvier 2018, par Ouroboros

    My question is how do the IP camera stream the data from home network to public network. Here’s how I think it can be done :

    1. If I’d to set up something like this using a raspberry pi camera module. I’d probably use port forwarding on my Access Point/Wifi Router. However, clearly, this is not a scalable solution, and there must be something else that off the shelf IP cameras must be doing.

    2. One option is to stream the video (using ffmpeg) to a remove server, and then that remote server can probably again "re-stream" that ? -If this is indeed the case, how is it done ?

    I understand backend architecture very strongly, and have developed fairly complex onces so I do want a fairly technical answer for this one.

  • Fluent-FFMPEG redirects to home page when recording is finished

    25 mai 2022, par Myles Jefferson

    I am using fluent-FFmpeg with my node.js and express server to record videos from an RTSP stream. The issue I am encountering is that once the command to record the video is finished, my React client-side always redirects to the home page of my application, even though this is not the behavior I want. I want the user to remain on the page with the RTSP stream and just receive a toast notification indicating that the recording is finished. With this issue, the page redirects before the notification has a chance to display. Is this an issue with my server-side or client-side code ?

    


    Node.js

    


    export const startRecording = async (req, res) => {
  const camera = req.params;
  if (camera.id in runningCommands) { return res.json({ "status": "failure", "error": "Recording already in progress" }) }
  const { recordTime, uid } = req.body;
  let conn = createConnection(config);
  conn.connect();
  let query = 'SELECT * FROM cameras WHERE id = ?';
  conn.query(query, [camera.id], (error, rows) => {
    if (error) { return res.json({ "status": "failure", "error": error }) }
    const camera = rows[0];
    const { ip, fname } = camera;
    const currentDate = new Date().toLocaleString().replace(/[:/\s]/g, '-').replace(',', '');
    const filename = `${fname}-${currentDate}`;

    try {
      // FFmpeg command to start recording
      const command = ffmpeg(`rtsp://${ip}/axis-media/media.amp`)
        .videoCodec('libx264')
        .size('1280x720')
        .duration(recordTime)
        .on('start', commandLine => {
          runningCommands[camera.id] = command
          console.log(`Spawned Ffmpeg with command: ${commandLine}`)
        })
        .on('error', err => console.error(err))
        .on('end', () => {
          delete runningCommands[camera.id]
          console.log('Recording Complete')
          takeScreenshot(filename, `./public/recordings/mp4/${filename}.mp4`)
          conn.query('INSERT INTO recordings (uid, cid, filename) VALUES (?, ?, ?)', [uid, camera.id, filename], () => conn.end())
          res.json({ "status": "success", "message": "Recording ended" })
        })
        .save(`./public/recordings/mp4/${filename}.mp4`);
    } catch (error) { console.error(error)}
  })
}


    


    React :

    


    const handleRecording = async () => {
    try {
      setIsRecording(true)
      const futureTime = new Date().getTime() + recordTime * 1000
      const finishedTime = new Date(futureTime).toLocaleTimeString()
      setTimeRemaining(finishedTime)
      const { data } = await publicRequest.post(`record/startRecording/${id}`, { recordTime, uid: user.id })
      window.location.reload(false)
      if (data.status === 'success') {
        setIsRecording(false)
        toast('Recording finished!', { type: 'success' })
      } else {
        setIsRecording(true)
        toast('Recording already in progress!', { type: 'error' })
      }
    } catch (error) {
      console.error(error)
    }
  }