Recherche avancée

Médias (1)

Mot : - Tags -/berlin

Autres articles (58)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (9194)

  • How to convert mp4 to mp3 in Android Java ?

    16 août 2023, par Akshit

    I have the mp4 link of a video but don't have a link for the mp3 version of that mp4 video. So is there any way that I can convert that mp4 video to mp3 in Android ? I saw some resources but nothing works for me. I have two ways in which I believe this can be achieved

    


      

    1. Convert the mp4 link to mp3 directly. (Not Sure if this is achievable)
    2. 


    3. Download the mp4 on the device with the help of a link and then use some code to convert that mp4 to mp3.
    4. 


    


    I also tried some solutions which are available online

    


    https://github.com/tanersener/mobile-ffmpeg

    


    I tried the above library to achieve the final goal. But got : Async command execution failed with returnCode=1.

    


    This error in the code I am using is :

    


    private class Mp4ToMp3ConverterTask extends AsyncTask {
    @Override
    protected String doInBackground(String... params) {
        String mp4FilePath = params[0];
        String mp3OutputPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/output.mp3";

        String[] ffmpegCommand = {"-i", mp4FilePath, "-vn", "-ar", "44100", "-ac", "2", "-b:a", "192k", mp3OutputPath};


        Config.enableStatisticsCallback(new StatisticsCallback() {
            public void apply(Statistics newStatistics) {
                Log.d("Dekh", String.format("frame: %d, time: %d", newStatistics.getVideoFrameNumber(), newStatistics.getTime()));
            }
        });

        long executionIdd = FFmpeg.executeAsync(ffmpegCommand, new ExecuteCallback() {
            @Override
            public void apply(final long executionId, final int returnCode) {
                if (returnCode == RETURN_CODE_SUCCESS) {
                    Log.i("Dekh", "Async command execution completed successfully.");
                } else if (returnCode == RETURN_CODE_CANCEL) {
                    Log.i("Dekh", "Async command execution cancelled by user.");
                } else {
                    Log.i("Dekh", String.format("Async command execution failed with returnCode=%d.", returnCode));
                }
            }
        });

        FFmpeg.cancel(executionIdd);

        return mp3OutputPath;
    }
}


    


    Solution number 2 which I used is :

    


    https://androidprogrammatically425516919.wordpress.com/2020/04/21/how-to-convert-video-to-audio-in-android-programmatically/

    


    But I got an error here also : Failed to instantiate extractor.
    
And another error is : java.io.FileNotFoundException: open failed: EISDIR (Is a directory)

    


    I tried the online available solution to solve these errors but nothing worked. Such as granting write permission. Providing a valid location to save the output.

    


    But nothing works so far. Please help me on this. Thank you.

    


  • ffmpeg : md5 of m3u8 playlists generated from same input video with different segment durations (after applying video filter) don't match

    15 juillet 2020, par Saurabh P Bhandari

    Here are a few commands I am using to convert and transize a video in mp4 format to a m3u8 playlist.

    


    For a given input video (mp4 format), generate multiple video only segments with segment duration 30s

    


    ffmpeg -loglevel error -i input.mp4 -dn -sn -an -c:v copy -bsf:v h264_mp4toannexb -copyts -start_at_zero -f segment -segment_time 30 30%03d.mp4 -dn -sn -vn -c:a copy audio.aac


    


    Apply video filter (in this case scaling) on each segment and convert it to a m3u8 format

    


    ls 30*.mp4 | parallel 'ffmpeg -loglevel error -i {} -vf scale=-2:144 -hls_list_size 0 {}.m3u8'


    


    Store the list of m3u8 files generated in list.txt in this format file 'segment-name.m3u8'

    


    for f in 30*.m3u8; do echo "file '$f'" >> list.txt; done


    


    Using concat demuxer, combine all segment files (which are in m3u8 format) and the audio to get one final m3u8 playlist pointing to segments with duration of 10s.

    


    ffmpeg -loglevel error -f concat -i list.txt -i audio.aac -c copy -hls_list_size 0 -hls_time 10 output_30.m3u8


    



    


    I can change the segment duration in the first step from 30s to 60s, and compare the md5 of the final m3u8 playlist generated in both the cases using this command

    


    ffmpeg -loglevel error -i <input m3u8="m3u8" playlist="playlist" /> -f md5 - &#xA;

    &#xA;

    The md5 of the output files differ i.e video streams of output_30.m3u8 and output_60.m3u8 are not the same.

    &#xA;

    Can anyone elaborate on this ?

    &#xA;

    (I expected the md5 to be the same)

    &#xA;

  • How to use FFMPEG to send image via RTMP using ProcessBuilder

    13 mai 2022, par ljnoah

    I have a callback function that gives me frames as bytes type to which I would like to pass as FFMPEG parameter to write them to a rtmp URL. but I don't really have any experience with ffmpeg, thus far I was not able to find an example on how to do it. Basically, I would like to know can I use use the bytes array that is FrameData that holds the images I am getting and write to ffmpeg as a parameter to be sent via streaming to a server using ProcessBuilder.

    &#xA;

     private byte[] FrameData = new byte[384 * 288 * 4];&#xA;    private final IFrameCallback mIFrameCallback = new IFrameCallback() {&#xA;          @Override&#xA;          public void onFrame(final ByteBuffer frameData) {&#xA;              frameData.clear();&#xA;              frameData.get(FrameData, 0, frameData.capacity());&#xA;              ProcessBuilder pb = new ProcessBuilder(ffmpeg ,  "-y",  "-f", "rawvideo",  "vcodec", "rawvideo",  "-pix_fmt", "bgr24",&#xA;                    "-r", "25",&#xA;                    "-i", "-",&#xA;                    "-c:v", "libx264",&#xA;                    "-pix_fmt", "yuv420p",&#xA;                    "-preset", "ultrafast",&#xA;                    "-f", "flv",&#xA;                    "rtmp://192.168.0.13:1935/live/test");&#xA;              }&#xA;            Log.e(TAG, "mIFrameCallback: onFrame------");&#xA;            try {&#xA;                pb.inheritIO().start().waitFor();&#xA;            } catch (InterruptedException | IOException e) {&#xA;                e.printStackTrace();&#xA;            }&#xA;      };&#xA;

    &#xA;

    This callback gives me the frames from my camera on the fly and writes it to FrameData, which I can compress to a bitmap if needed. The current attempt isn't working as I have no idea how to pass my byte array as a parameter to ffmpeg to be streamed via rtmp as above to push my frames from the camera that are stored FrameData byte buffer via RTMP/RTSP to my server IP. I would use a similar approach in python like this :

    &#xA;

     import subprocess&#xA;    fps = 25&#xA;    width = 224&#xA;    height = 224&#xA;    command = [&#x27;ffmpeg&#x27;,  &#x27;-y&#x27;,  &#x27;-f&#x27;, &#x27;rawvideo&#x27;,  &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;,  &#x27;-pix_fmt&#x27;, &#x27;bgr24&#x27;,&#xA;               &#x27;-s&#x27;, "{}x{}".format(width, height),&#xA;               &#x27;-r&#x27;, str(fps),&#xA;               &#x27;-i&#x27;, &#x27;-&#x27;,&#xA;               &#x27;-c:v&#x27;, &#x27;libx264&#x27;,&#xA;               &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;,&#xA;               &#x27;-preset&#x27;, &#x27;ultrafast&#x27;,&#xA;               &#x27;-f&#x27;, &#x27;flv&#x27;,&#xA;               &#x27;rtmp://192.168.0.13:1935/live/test&#x27;]&#xA;    p = subprocess.Popen(command, stdin=subprocess.PIPE)&#xA;    while(True):&#xA;        frame = np.random.randint([255], size=(224, 224, 3))&#xA;        frame = frame.astype(np.uint8)&#xA;        p.stdin.write(frame.tobytes())&#xA;

    &#xA;

    I really don't understand how to write my byte arrays to the ffmpeg as I would in this Python example above.&#xA;What I tried doing was this :

    &#xA;

     private byte[] FrameData = new byte[384 * 288 * 4];&#xA;    String ffmpeg = Loader.load(org.bytedeco.ffmpeg.ffmpeg.class);&#xA;    private final IFrameCallback mIFrameCallback = new IFrameCallback() {&#xA;        @RequiresApi(api = Build.VERSION_CODES.O)&#xA;        @Override&#xA;        public void onFrame(final ByteBuffer frameData) {&#xA;            frameData.clear();&#xA;            frameData.get(FrameData, 0, frameData.capacity());&#xA;            ProcessBuilder pb = new ProcessBuilder(ffmpeg ,  "-y",  "-f", "rawvideo",  "vcodec", "rawvideo",  "-pix_fmt", "bgr24",&#xA;                    "-r", "25",&#xA;                    "-i", "-",&#xA;                    "-c:v", "libx264",&#xA;                    "-pix_fmt", "yuv420p",&#xA;                    "-preset", "ultrafast",&#xA;                    "-f", "flv",&#xA;                    "rtmp://192.168.0.13:1935/live/test");&#xA;        try {&#xA;&#xA;            Log.e(TAG, "mIFrameCallback: onFrame------");&#xA;            pb.redirectInput();&#xA;            pb.redirectError();&#xA;            Log.e(TAG, "frame data check 1");&#xA;            Process p = pb.start();&#xA;            Log.e(TAG, "frame data check 2");&#xA;            p.getOutputStream().write(FrameData);&#xA;            Log.e(TAG, "frame data check 3");&#xA;        } catch (IOException e) {&#xA;            e.printStackTrace();&#xA;        }&#xA;        }&#xA;    };&#xA;

    &#xA;

    Unfortunately, no results whatsoever. It appears that the try/catch block is not executed, I am not even sure if this is the right way to send bytes via RTMP stream

    &#xA;

    Edit : I have fixed the indicated issue with the ProcessBuilder being called twice and logged the calls made inside the code, it only calls up to : Log.e(TAG, "frame data check 1"); Although, I am still not sure if that's the write way to write an array of bytes to ffmpeg for rtmp streaming.

    &#xA;