Recherche avancée

Médias (0)

Mot : - Tags -/serveur

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (55)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash 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 (6910)

  • How to convert video file to audio file by using FFMPEG ?

    15 janvier 2020, par Aamir Naseer

    I’m making video to audio converter app but need help to convert video to audio using ffmpeg. I checked many answers and websites but their answers are not easy to understand and I’m confused with command that is used to convert. What is the proper command to convert video to audio and is I’m executing the command in right way ?

    public class VideoConvertActivity extends AppCompatActivity {

       private VideoView videoView;
       private Button convertButton;
       private String filePath;
       private FFmpeg ffmpeg;


       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_video_convert);

           videoView = findViewById(R.id.videoviewID);
           convertButton = findViewById(R.id.convertbuttonID);

           ffmpeg = FFmpeg.getInstance(VideoConvertActivity.this);

    // in variable video i'm getting the path of video path from previous activity through intent and that video will have to convert to audio file
           Intent extras = getIntent();
           final String video = extras.getStringExtra("video");

           videoView.setVideoPath(video);
           videoView.start();

           convertButton.setOnClickListener(new View.OnClickListener() {
               @Override
               public void onClick(View v) {

                   try {

                       File moviesDir = Environment.getExternalStoragePublicDirectory(
                               Environment.DIRECTORY_MUSIC
                       );

                       String filePrefix = "convert_audio";
                       String fileExtn = ".mp3";
                       File dest = new File(moviesDir, filePrefix + fileExtn);

                       int fileNo = 0;
                       while (dest.exists()) {
                           fileNo++;
                           dest = new File(moviesDir, filePrefix + fileNo + fileExtn);
                       }
                       filePath = dest.getAbsolutePath();

                       // to execute "ffmpeg -version" command you just need to pass "-version"
                       String[] command = {"-y", "-i", video, "-vn", "-ar", "44100", "-ac", "2", "-b:a", "256k", "-f", "mp3", filePath};
                       ffmpeg.execute(command, new ExecuteBinaryResponseHandler() {

                           @Override
                           public void onStart() {
                               Toast.makeText(VideoConvertActivity.this,"Started",Toast.LENGTH_LONG).show();
                           }

                           @Override
                           public void onProgress(String message) {
                               Toast.makeText(VideoConvertActivity.this,"Progress",Toast.LENGTH_LONG).show();
                           }

                           @Override
                           public void onFailure(String message) {
                               Toast.makeText(VideoConvertActivity.this,"Failed",Toast.LENGTH_LONG).show();
                           }

                           @Override
                           public void onSuccess(String message) {
                               Toast.makeText(VideoConvertActivity.this,"Succeed",Toast.LENGTH_LONG).show();
                           }

                           @Override
                           public void onFinish() {
                               Toast.makeText(VideoConvertActivity.this,"Finished",Toast.LENGTH_LONG).show();
                           }
                       });
                   } catch (FFmpegCommandAlreadyRunningException e) {
                       // Handle if FFmpeg is already running
                   }

                    Toast.makeText(VideoConvertActivity.this,"Converted Successfully",Toast.LENGTH_SHORT).show();

               }
           });

       }

    }
  • Invalid argument error in writing video file using moviepy and ffmpeg

    28 janvier 2024, par Kresreb

    I have this code that used to work fine and now isn't. I have this error :

    


        Traceback (most recent call last):&#xA;  File "D:\videos\tiktoks\faitsasavoir\bot\mre.py", line 18, in <module>&#xA;    clip_final.write_videofile(f"rendus_finaux/output.mp4", fps=24)&#xA;  File "", line 2, in write_videofile&#xA;  File "C:\Users\Brice\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration&#xA;    return f(clip, *a, **k)&#xA;  File "", line 2, in write_videofile&#xA;  File "C:\Users\Brice\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\decorators.py", line 135, in use_clip_fps_by_default&#xA;    return f(clip, *new_a, **new_kw)&#xA;  File "", line 2, in write_videofile&#xA;  File "C:\Users\Brice\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB&#xA;    return f(clip, *a, **k)&#xA;  File "C:\Users\Brice\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\video\VideoClip.py", line 300, in write_videofile&#xA;    ffmpeg_write_video(self, filename, fps, codec,&#xA;  File "C:\Users\Brice\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 228, in ffmpeg_write_video&#xA;    writer.write_frame(frame)&#xA;  File "C:\Users\Brice\AppData\Local\Programs\Python\Python39\lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 180, in write_frame&#xA;    raise IOError(error)&#xA;OSError: [Errno 22] Invalid argument&#xA;&#xA;MoviePy error: FFMPEG encountered the following error while writing file rendus_finaux/output.mp4:&#xA;&#xA; b&#x27;rendus_finaux/output.mp4: No such file or directory\r\n&#x27;&#xA;</module>

    &#xA;

    It tried different versions of moviepy, Python and reinstalling ffmpeg etc, but couldn't solve it. My main idea is that is a version problem, but i can't find out.

    &#xA;

    I recreated the error with this mre, it's just a code to make a video from multiple images. Thank you for your help.

    &#xA;

    from moviepy.editor import ImageClip, CompositeVideoClip, concatenate_videoclips&#xA;    &#xA;    DURATION_PER_IMAGE = 5&#xA;    &#xA;    images = ["D:/videos/image1.png","D:/videos/image1.jpg"]&#xA;    &#xA;    clips = []&#xA;    for image in images:&#xA;        #Main image&#xA;        clip = ImageClip(image).set_duration(DURATION_PER_IMAGE).resize(width=1080)&#xA;        clip = clip.resize(lambda t : 1&#x2B;0.02*t)&#xA;    &#xA;        #Create clip composite&#xA;        clip_composite = CompositeVideoClip([clip.set_position("center")], size=(1080,1920))&#xA;        clips.append(clip_composite) # Add created clip to the list of clips&#xA;    &#xA;    clip_final = concatenate_videoclips(clips)&#xA;    clip_final.write_videofile(f"rendus_finaux/output.mp4", fps=24)&#xA;

    &#xA;

  • Unable to extract KLV data from .mpg file

    2 novembre 2023, par Arjun Shastry

    I need to extract the klv data embedded in the following file :&#xA;https://samples.ffmpeg.org/MPEG2/mpegts-klv/Day%20Flight.mpg

    &#xA;

    Currently, I am doing it using ffmpeg and python.&#xA;The code works for .ts files like the example given below, but not the above mpg file. :&#xA;https://www.arcgis.com/home/item.html?id=55ec6f32d5e342fcbfba376ca2cc409a

    &#xA;

    I used the following python command, using subprocess, ffmpeg to extract klv data in a binary file and then using klvdata library to tranlate to a readable text file.

    &#xA;

    #Extract klv data and output as binary file&#xA;command=[&#x27;ffmpeg&#x27;, &#x27;-i&#x27;, input_video, &#x27;-map&#x27;, &#x27;d&#x27;,&#x27;-codec&#x27;,&#x27;copy&#x27;,&#x27;-f&#x27;, &#x27;data&#x27;,&#x27;out.bin&#x27;]&#xA;process=subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)&#xA;stdout, stderr = process.communicate()&#xA;&#xA;print(stdout)&#xA;print(stderr)&#xA;&#xA;#Open text file to write json data&#xA;outjson=open("./outjson.txt","w")&#xA;print("Flag 1")&#xA;&#xA;# Open the out.bin file for reading as binary&#xA;with open("./out.bin", "rb") as f:&#xA;    sample=[]&#xA;    cnt=0&#xA;    for packet in klvdata.streamparser.StreamParser(f):&#xA;        pack=[]&#xA;        metadata = packet.MetadataList()&#xA;        for i in (5,6,7,13,14,15,18,19,23,24,25,26,27,28,29,30,31,32,33):#Only extracting required data&#xA;            pack.append(metadata[i][-1])&#xA;        sample.append(pack)&#xA;    sampleLength=(len(sample))&#xA;    json.dump(sample,outjson,indent=4) # Convert the metadata to a string and write it to outtext.txt&#xA;

    &#xA;

    When doing it for "Day Flight.mpg", the following error occurs :

    &#xA;

    58. 19.100 / 58. 19.100\r\n  libavcodec     60. 26.100 / 60. 26.100\r\n  libavformat    60. 11.100 / 60. 11.100\r\n  libavdevice    60.  2.101 / 60.  2.101\r\n  libavfilter     9. 11.100 /  9. 11.100\r\n  libswscale      7.  3.100 /  7.  3.100\r\n  libswresample   4. 11.100 /  4. 11.100\r\n  libpostproc    57.  2.100 / 57.  2.100\r\n[mpegts @ 0000026bb99387c0] start time for stream 1 is not set in estimate_timings_from_pts\r\nInput #0, mpegts, from &#x27;C:/Users/ashastry/Downloads/Day Flight.mpg&#x27;:\r\n  Duration: 00:03:14.88, start: 10.000000, bitrate: 4187 kb/s\r\n  Program 1 \r\n  Stream #0:0[0x1e1]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, 60 fps, 60 tbr, 90k tbn\r\n  Stream #0:1[0x1f1]: Data: klv (KLVA / 0x41564C4B)\r\nOutput #0, data, to &#x27;out.bin&#x27;:\r\n  Metadata:\r\n    encoder         : Lavf60.11.100\r\n  Stream #0:0: Data: klv (KLVA / 0x41564C4B)\r\nStream mapping:\r\n  Stream #0:1 -> #0:0 (copy)\r\nPress [q] to stop, [?] for help\r\nsize=       0kB time=00:00:00.00 bitrate=N/A speed=N/A    \rsize=       0kB time=00:00:00.00 bitrate=N/A speed=   0x    \rsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    \r[out#0/data @ 0000026bbb61b300] video:0kB audio:0kB subtitle:0kB other streams:1kB global headers:0kB muxing overhead: 0.000000%\r\nsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    \r\n"&#xA;Flag 1&#xA;Traceback (most recent call last):&#xA;&#xA;  File C:\ProgramData\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec&#xA;    exec(code, globals, locals)&#xA;&#xA;  File c:\users\ashastry\desktop\gis\javascript\extract.py:34&#xA;    metadata = packet.MetadataList()&#xA;&#xA;AttributeError: &#x27;UnknownElement&#x27; object has no attribute &#x27;MetadataList&#x27;&#xA;

    &#xA;