Recherche avancée

Médias (1)

Mot : - Tags -/belgique

Autres articles (65)

Sur d’autres sites (13309)

  • how to use ffmpeg to get thumbnails from a video

    23 mai 2017, par okendo

    I have been trying over weeks now to figure out how to use ffmpeg to get thumbnail from a video while upload that video in php.
    This is my code and I don’t where I went wrong please help.

    <?php
    if (logged_in() === true) {
       if (isset($_POST['up'], $_FILES['file'])) {
           $file_name = $_FILES['file']['name'];
           $file_type = explode('.', $file_name);
           $file_type = strtolower(end($file_type));
           $random    = rand();
           $file_tmp  = $_FILES['file']['tmp_name'];

       $file_dir = "jobalertme/includes/video_uploads/$random.$file_type";
       if ($file_type == 'mp4' || $file_type == 'avi' || $file_type == 'wmv' || $file_type == 'mov' || $file_type == 'flv') {
           if (move_uploaded_file($file_tmp, "$file_dir")) {
               $ffmpeg    = "C:\\ffmpeg\\bin\\ffmpeg";
               $img_name  = "1.jpg";
               $img_size  = "120x90";
               $getimgsec = 5;
               $cmd       = "$ffmpeg -i $file_tmp -an -ss $getimgsec -s $img_size  www/jobalertme/includes/img_thumnail/$img_name <br />";
               if (shell_exec($cmd)) {
                   echo "ok";
               } else {
                   echo "not";
               }


               $updat = "UPDATE registration SET video='$file_dir' WHERE uname='$username'";
               $qry   = mysqli_query($con, $updat);
               if ($qry) {
                   echo "<code class="echappe-js">&lt;script&gt; alert('your file has been successfully uploaded ')&lt;/script&gt;

    " ;
    echo "&lt;script&gt;window.open('upload_vid.php','_self')&lt;/script&gt;" ;
    exit() ;
    else
    echo "&lt;script&gt; alert('we ran into some problems')&lt;/script&gt;" ;
    echo "&lt;script&gt;window.open('upload_vid.php','_self')&lt;/script&gt;" ;
    exit() ;

    else
    echo "&lt;script&gt; alert('we ran into some problems')&lt;/script&gt;" ;
    echo "&lt;script&gt;window.open('upload_vid.php','_self')&lt;/script&gt;" ;
    exit() ;

    else
    echo "&lt;script&gt;alert('please this file extension is not allowed, it must be an mp4 file format')&lt;/script&gt;" ;
    echo "&lt;script&gt;window.open('upload_vid.php','_self')&lt;/script&gt;" ;
    exit() ;


    else
    echo "

    &lt;script&gt;alert('please you need login before you can upload resume.')&lt;/scrpt&gt;&quot;;<br />
       echo &quot;&lt;script&gt;window.open('upload_vid.php','_self')&lt;/script&gt;

    " ;
    exit() ;

     ?>

    I have search on google youtube and others but still have not gotten the solution.

  • lavu/libm : add exp10 support

    22 décembre 2015, par Ganesh Ajjanagadde
    lavu/libm : add exp10 support
    

    exp10 is a function available in GNU libm. Looks like no other common
    libm has it. This adds support for it to FFmpeg.

    There are essentially 2 ways of handling the fallback :
    1. Using pow(10, x)
    2. Using exp2(M_LOG2_10 * x).

    First one represents a Pareto improvement, with no speed or accuracy
    regression anywhere, but speed improvement limited to GNU libm.

    Second one represents a slight accuracy loss (relative error 1e-13)
    for non GNU libm. Speedup of > 2x is obtained on non GNU libm platforms,
     30% on GNU libm. These are "average case numbers", another benefit is
    the lack of triggering of the well-known terrible worst case paths
    through pow.

    Based on reviews, second one chosen. Comment added accordingly.

    Reviewed-by : Hendrik Leppkes <h.leppkes@gmail.com>
    Reviewed-by : Michael Niedermayer <michael@niedermayer.cc>
    Reviewed-by : Ronald S. Bultje <rsbultje@gmail.com>
    Signed-off-by : Ganesh Ajjanagadde <gajjanagadde@gmail.com>

    • [DH] configure
    • [DH] libavutil/libm.h
  • Webm video files recorded on Chrome Mobile cannot be converted to MP4

    7 juillet 2022, par Tobias Kristensen

    I have a website where I record the user's webcam via the MediaRecorder API.&#xA;The video stream is created with navigator.mediaDevices.getUserMedia() :

    &#xA;

    // Create stream&#xA;const cameraStream = await navigator.mediaDevices.getUserMedia({ video: &#xA;  { &#xA;    aspectRatio: 1/1, &#xA;    facingMode: &#x27;user&#x27;,&#xA;    width: { min: 360, ideal: 720, max: 1080 },&#xA;    height: { min: 360, ideal: 720, max: 1080 },&#xA;    deviceId: undefined&#xA;  }  &#xA;});&#xA;&#xA;// Add stream to videoElement to display a video preview&#xA;videoElement.srcObject = cameraStream; &#xA;

    &#xA;

    I then check which mime types are available in the browser and use that info to initialize the MediaRecorder :

    &#xA;

    const validMimeTypes = [&#xA;  "video/webm\;codecs=vp8",&#xA;  "video/webm\;codecs=daala",&#xA;  "video/webm\;codecs=h264",&#xA;  "video/webm",&#xA;  "video/mpeg"&#xA;];&#xA;&#xA;const getFirstAvailableMimeType = () => {&#xA;  for (const mimeType of validMimeTypes) {&#xA;    if (MediaRecorder.isTypeSupported(mimeType)) {&#xA;      return mimeType;&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;// Initialize Media Recorder&#xA;const mediaRecorder = new MediaRecorder(cameraStream, {&#xA;  mimeType: getFirstAvailableMimeType(),&#xA;});&#xA;

    &#xA;

    After I finish recording a video, I upload it to a server and store it on Firebase Storage, so it can be downloaded later.

    &#xA;

    After downloading a video, I would like to convert it to an MP4 file. I've tried using CloudConvert and HandBrake. Both services have no issues converting videos that were recorded via Chrome on my desktop, but both fail when I try to convert videos recorded via Chrome Mobile on my phone.

    &#xA;

    When trying to convert the video to MP4 via CloudConvert, the following error is shown :

    &#xA;

    EBML header parsing failed. /input/import1/69fcceaccc27a0d6eabcb8a65045e87e.webm Invalid data found when processing input&#xA;

    &#xA;

    Any ideas how I can resolve this issue ?

    &#xA;