Recherche avancée

Médias (33)

Mot : - Tags -/creative commons

Sur d’autres sites (129)

  • Output file does not show up after executing ffmpeg command [closed]

    19 février, par davai

    I'm using ffmpeg to combine an MP3 + G file and produce an MP4 file. I've placed the source code / .exe file for 'ffmpeg' in the project folder, and the MP3 + G files are also in the project folder. I also set the MP4 output to show up in the project folder as well. The weird thing is that, initially, I was producing output files, and while trying to tweak the constant rate factor, the MP4 output just stopped showing up entirely. I'm also not receiving any errors while running the code, and it does print out that the file has been successfully created, despite nothing showing up in the project folder.

    


    
        String mp3FilePath = "C:/Users/exampleuser/pfolder/example.mp3";
        String gFilePath = "C:/Users/exampleuser/pfolder/example.cdg";
        String mp4OutputPath = "C:/Users/exampleuser/pfolder/example.mp4";

        try
        {
            String[] command = {
                    "C:/Users/tonih/IdeaProjects/MP3GtoMP4Conversion/ffmpeg/ffmpeg-2024-02-19-git-0c8e64e268-full_build/bin/ffmpeg.exe",
                    "-i", mp3FilePath,       // Input MP3 file
                    "-r", "25",              // Frame rate
                    "-loop", "1",            // Loop input video
                    "-i", gFilePath,         // Input G file
                    "-c:v", "libx264",       // Video codec
                    "-preset", "slow",       // Encoding preset for quality (choose according to your requirement)
                    "-crf", "18",            // Constant Rate Factor (lower is higher quality, typical range 18-28)
                    "-c:a", "aac",           // Audio codec
                    "-b:a", "320k",          // Audio bitrate
                    "-shortest",             // Stop when the shortest stream ends
                    mp4OutputPath            // Output MP4 file
            };

            Process process = Runtime.getRuntime().exec(command);
            process.waitFor();
            System.out.println("MP4 file created successfully: " + mp4OutputPath);
        }
        catch (IOException | InterruptedException e)
        {
            e.printStackTrace();
        }


    


  • How can I publish an RTSP stream to a MediaMTX instance with TLS encryption configured ? [closed]

    15 février, par cmd

    I have an instance of (MediaMTX) running on my laptop. I have an Amcrest IP camera. I can publish the camera's RTSP stream to the server so that the stream can be accessed from the MediaMTX instance.

    


    However, I want to encrypt the stream. On the Github page for MediaMTX, they detail how TLS encryption can be enabled for incoming and outgoing RTSP streams by generating a server.key and server.crt and editing lines in the .yml configuration file. Streams can then be published and read with RTSPS and port 8322.

    


    I have followed these steps, and set up the following path for my IP camera in the .yml :

    


    ###############################################
# Path settings

# Settings in "paths" are applied to specific paths, and the map key
# is the name of the path.
# Any setting in "pathDefaults" can be overridden here.
# It's possible to use regular expressions by using a tilde as prefix,
# for example "~^(test1|test2)$" will match both "test1" and "test2",
# for example "~^prefix" will match all paths that start with "prefix".
paths:

  cam1:
    source: rtsp://user:password@192.168.68.142:554
    runOnInit: ffmpeg -i rtsp://user:password@192.168.68.142:554 -c:v copy -c:a copy -f rtsp rtsps://localhost:8322/stream/cam1


    


    But I am getting the following output from my MediaMTX instance when it runs :

    


    2024/02/15 18:20:59 INF [path cam1] [RTSP source] ready: 2 tracks (H264, MPEG-4 Audio)
Input #0, rtsp, from 'rtsp://user:password@192.168.68.142:554':
  Metadata:
    title           : Media Server
  Duration: N/A, start: 0.030000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080, 100 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
2024/02/15 18:21:00 INF [RTSPS] [conn [::1]:60147] opened
2024/02/15 18:21:00 INF [RTSPS] [session 07a8f23e] created by [::1]:60147
2024/02/15 18:21:00 INF [RTSPS] [conn [::1]:60147] closed: path 'stream/cam1' is not configured
2024/02/15 18:21:00 INF [RTSPS] [session 07a8f23e] destroyed: not in use
[out#0/rtsp @ 00000225c75fe9c0] Could not write header (incorrect codec parameters ?): Server returned 400 Bad Request
Conversion failed!
2024/02/15 18:21:00 INF [path cam1] runOnInit command exited: command exited with code 3486501640
2024/02/15 18:21:29 WAR [path cam1] [RTSP source] 10 RTP packets lost
2024/02/15 18:21:33 WAR [path cam1] [RTSP source] 2 RTP packets lost
2024/02/15 18:21:39 WAR [path cam1] [RTSP source] 11 RTP packets lost


    


    I have no errors and was able to publish the stream with the same path configuration (using rtsp ://, not rtsps ://) when using no encryption. What possible solutions can I try ?

    


  • VideoJS for HLS streaming not working on iOS

    13 février, par Aames

    I have a website where I stream audio using HLS (m3u8 playlist + ts files).
I use VideoJS 8.3.0 to handle the stream in the frontend side.
The streaming works in all devices (PC, Android, Mac) except in iOS where it works intermittently and often it blocks.

    


    Here is my videojs initialization :

    


    player = videojs('stream-id', {
            controls: false, autoplay: true, preload: 'auto',
            html5: {
               vhs: {overrideNative: false},
               nativeAudioTracks: true
           }
        });

...

player.src({ type: 'application/x-mpegURL', src: 'https://.../master.m3u8' });



    


    And these are the headers of the m3u8 file :

    


    #EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:10
#EXT-X-PROGRAM-DATE-TIME:2024-02-13T09:00:00Z
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-DISCONTINUITY
#EXTINF:10.007800,
master0.ts
#EXTINF:7.214989,
master1.ts
....


    


    I use ffmpeg to create the playlist from mp3 files :

    


    ffmpeg -i inputFileName -c:a aac -b:a 128k -ac 2 -f hls -hls_time 10 -preset ultrafast -map 0:a -flags -global_header -hls_list_size 0 -hls_flags append_list outputFileName



    


    Am I doing something wrong ? Any help would be appreciated
Thanks

    


    I tried this solution : Videojs HLS m3u8 files are not playing in iOS devices and safari browser but it does not work for me