Recherche avancée

Médias (91)

Autres articles (40)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • 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 a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (6757)

  • How to properly close a FFmpeg stream and AVFormatContext without leaking memory ?

    13 décembre 2019, par Darkwonder

    I have built an app that uses FFmpeg to connect to remote IP cameras in order to receive video and audio frames via RTSP 2.0.

    The app is built using Xcode 10-11 and Objective-C with a custom FFmpeg build config.

    The architecture is the following :

    MyApp


    Document_0

       RTSPContainerObject_0
           RTSPObject_0

       RTSPContainerObject_1
           RTSPObject_1

       ...
    Document_1
    ...

    GOAL :

    1. After closing Document_0 no FFmpeg objects should be leaked.
    2. The closing process should stop-frame reading and destroy all objects which use FFmpeg.

    PROBLEM :

    enter image description here

    1. Somehow Xcode’s memory debugger shows two instances of MyApp.

    FACTS :

    • macOS’es Activity Monitor doesn’t show two instances of MyApp.

    • macOS’es Activity Monitor doesn’t any instances of FFmpeg or other child processes.

    • The issue is not related to some leftover memory due to a late memory snapshot since it can be reproduced easily.

    • Xcode’s memory debugger shows that the second instance only having RTSPObject's AVFormatContext and no other objects.

      1. The second instance has an AVFormatContext and the RTPSObject still has a pointer to the AVFormatContext.

    FACTS :

    • Opening and closing the second document Document_1 leads to the same problem and having two objects leaked. This means that there is a bug that creates scalable problems. More and more memory is used and unavailable.

    Here is my termination code :

      - (void)terminate
    {
       // * Video and audio frame provisioning termination *
       [self stopVideoStream];
       [self stopAudioStream];
       // *

       // * Video codec termination *
       avcodec_free_context(&_videoCodecContext); // NULL pointer safe.
       self.videoCodecContext = NULL;
       // *

    // * Audio codec termination *
    avcodec_free_context(&_audioCodecContext); // NULL pointer safe.
    self.audioCodecContext = NULL;
    // *

    if (self.packet)
    {
       // Free the packet that was allocated by av_read_frame.
       av_packet_unref(&packet); // The documentation doesn't mention NULL safety.
       self.packet = NULL;
    }

    if (self.currentAudioPacket)
    {
       av_packet_unref(_currentAudioPacket);
       self.currentAudioPacket = NULL;
    }

    // Free raw frame data.
    av_freep(&_rawFrameData); // NULL pointer safe.

    // Free the swscaler context swsContext.
    self.isFrameConversionContextAllocated = NO;
    sws_freeContext(scallingContext); // NULL pointer safe.

    [self.audioPacketQueue removeAllObjects];

    self.audioPacketQueue = nil;

    self.audioPacketQueueLock = nil;
    self.packetQueueLock = nil;
    self.audioStream = nil;
    BXLogInDomain(kLogDomainSources, kLogLevelVerbose, @"%s:%d: All streams have been terminated!", __FUNCTION__, __LINE__);

    // * Session context termination *
    AVFormatContext *pFormatCtx = self.sessionContext;
    BOOL shouldProceedWithInputSessionTermination = self.isInputStreamOpen && self.shouldTerminateStreams && pFormatCtx;
    NSLog(@"\nTerminating session context...");
    if (shouldProceedWithInputSessionTermination)
    {
       NSLog(@"\nTerminating...");
       //av_write_trailer(pFormatCtx);
       // Discard all internally buffered data.
       avformat_flush(pFormatCtx); // The documentation doesn't mention NULL safety.
       // Close an opened input AVFormatContext and free it and all its contents.
       // WARNING: Closing an non-opened stream will cause avformat_close_input to crash.
       avformat_close_input(&pFormatCtx); // The documentation doesn't mention NULL safety.
       NSLog(@"Logging leftovers - %p, %p  %p", self.sessionContext, _sessionContext, pFormatCtx);
       avformat_free_context(pFormatCtx);

       NSLog(@"Logging content = %c", *self.sessionContext);
       //avformat_free_context(pFormatCtx); - Not needed because avformat_close_input is closing it.
       self.sessionContext = NULL;
    }
    // *

    }

    IMPORTANT : The termination sequence is :

       New frame will be read.
    -[(RTSPObject)StreamInput currentVideoFrameDurationSec]
    -[(RTSPObject)StreamInput frameDuration:]
    -[(RTSPObject)StreamInput currentCGImageRef]
    -[(RTSPObject)StreamInput convertRawFrameToRGB]
    -[(RTSPObject)StreamInput pixelBufferFromImage:]
    -[(RTSPObject)StreamInput cleanup]
    -[(RTSPObject)StreamInput dealloc]
    -[(RTSPObject)StreamInput stopVideoStream]
    -[(RTSPObject)StreamInput stopAudioStream]

    Terminating session context...
    Terminating...
    Logging leftovers - 0x109ec6400, 0x109ec6400  0x109ec6400
    Logging content = \330
    -[Document dealloc]

    NOT WORKING SOLUTIONS :

    • Changing the order of object releases (The AVFormatContext has been freed first but it didn’t lead to any change).
    • Calling RTSPObject's cleanup method much sooner to give FFmpeg more time to handle object releases.
    • Reading a lot of SO answers and FFmpeg documentation to find a clean cleanup process or newer code which might highlight why the object release doesn’t happen properly.

    I am currently reading the documentation on AVFormatContext since I believe that I am forgetting to release something. This believe is based on the memory debuggers output that AVFormatContext is still around.

    Here is my creation code :

    #pragma mark # Helpers - Start

    - (NSError *)openInputStreamWithVideoStreamId:(int)videoStreamId
                                   audioStreamId:(int)audioStreamId
                                        useFirst:(BOOL)useFirstStreamAvailable
                                          inInit:(BOOL)isInitProcess
    {
       // NSLog(@"%s", __PRETTY_FUNCTION__); // RTSP
       self.status = StreamProvisioningStatusStarting;
       AVCodec *decoderCodec;
       NSString *rtspURL = self.streamURL;
       NSString *errorMessage = nil;
       NSError *error = nil;

       self.sessionContext = NULL;
       self.sessionContext = avformat_alloc_context();

       AVFormatContext *pFormatCtx = self.sessionContext;
       if (!pFormatCtx)
       {
           // Create approp error.
           return error;
       }


       // MUST be called before avformat_open_input().
       av_dict_free(&_sessionOptions);

           self.sessionOptions = 0;
           if (self.usesTcp)
           {
               // "rtsp_transport" - Set RTSP transport protocols.
               // Allowed are: udp_multicast, tcp, udp, http.
               av_dict_set(&_sessionOptions, "rtsp_transport", "tcp", 0);
           }
           av_dict_set(&_sessionOptions, "rtsp_transport", "tcp", 0);

       // Open an input stream and read the header with the demuxer options.
       // WARNING: The stream must be closed with avformat_close_input()
       if (avformat_open_input(&pFormatCtx, rtspURL.UTF8String, NULL, &_sessionOptions) != 0)
       {
           // WARNING: Note that a user-supplied AVFormatContext (pFormatCtx) will be freed on failure.
           self.isInputStreamOpen = NO;
           // Create approp error.
           return error;
       }

       self.isInputStreamOpen = YES;

       // user-supplied AVFormatContext pFormatCtx might have been modified.
       self.sessionContext = pFormatCtx;

       // Retrieve stream information.
       if (avformat_find_stream_info(pFormatCtx,NULL) < 0)
       {
           // Create approp error.
           return error;
       }

       // Find the first video stream
       int streamCount = pFormatCtx->nb_streams;

       if (streamCount == 0)
       {
           // Create approp error.
           return error;
       }

       int noStreamsAvailable = pFormatCtx->streams == NULL;

       if (noStreamsAvailable)
       {
           // Create approp error.
           return error;
       }

       // Result. An Index can change, an identifier shouldn't.
       self.selectedVideoStreamId = STREAM_NOT_FOUND;
       self.selectedAudioStreamId = STREAM_NOT_FOUND;

       // Fallback.
       int firstVideoStreamIndex = STREAM_NOT_FOUND;
       int firstAudioStreamIndex = STREAM_NOT_FOUND;

       self.selectedVideoStreamIndex = STREAM_NOT_FOUND;
       self.selectedAudioStreamIndex = STREAM_NOT_FOUND;

       for (int i = 0; i < streamCount; i++)
       {
           // Looking for video streams.
           AVStream *stream = pFormatCtx->streams[i];
           if (!stream) { continue; }
           AVCodecParameters *codecPar = stream->codecpar;
           if (!codecPar) { continue; }

           if (codecPar->codec_type==AVMEDIA_TYPE_VIDEO)
           {
               if (stream->id == videoStreamId)
               {
                   self.selectedVideoStreamId = videoStreamId;
                   self.selectedVideoStreamIndex = i;
               }

               if (firstVideoStreamIndex == STREAM_NOT_FOUND)
               {
                   firstVideoStreamIndex = i;
               }
           }
           // Looking for audio streams.
           if (codecPar->codec_type==AVMEDIA_TYPE_AUDIO)
           {
               if (stream->id == audioStreamId)
               {
                   self.selectedAudioStreamId = audioStreamId;
                   self.selectedAudioStreamIndex = i;
               }

               if (firstAudioStreamIndex == STREAM_NOT_FOUND)
               {
                   firstAudioStreamIndex = i;
               }
           }
       }

       // Use first video and audio stream available (if possible).

       if (self.selectedVideoStreamIndex == STREAM_NOT_FOUND && useFirstStreamAvailable && firstVideoStreamIndex != STREAM_NOT_FOUND)
       {
           self.selectedVideoStreamIndex = firstVideoStreamIndex;
           self.selectedVideoStreamId = pFormatCtx->streams[firstVideoStreamIndex]->id;
       }

       if (self.selectedAudioStreamIndex == STREAM_NOT_FOUND && useFirstStreamAvailable && firstAudioStreamIndex != STREAM_NOT_FOUND)
       {
           self.selectedAudioStreamIndex = firstAudioStreamIndex;
           self.selectedAudioStreamId = pFormatCtx->streams[firstAudioStreamIndex]->id;
       }

       if (self.selectedVideoStreamIndex == STREAM_NOT_FOUND)
       {
           // Create approp error.
           return error;
       }

       // See AVCodecID for codec listing.

       // * Video codec setup:
       // 1. Find the decoder for the video stream with the gived codec id.
       AVStream *stream = pFormatCtx->streams[self.selectedVideoStreamIndex];
       if (!stream)
       {
           // Create approp error.
           return error;
       }
       AVCodecParameters *codecPar = stream->codecpar;
       if (!codecPar)
       {
           // Create approp error.
           return error;
       }

       decoderCodec = avcodec_find_decoder(codecPar->codec_id);
       if (decoderCodec == NULL)
       {
           // Create approp error.
           return error;
       }

       // Get a pointer to the codec context for the video stream.
       // WARNING: The resulting AVCodecContext should be freed with avcodec_free_context().
       // Replaced:
       // self.videoCodecContext = pFormatCtx->streams[self.selectedVideoStreamIndex]->codec;
       // With:
       self.videoCodecContext = avcodec_alloc_context3(decoderCodec);
       avcodec_parameters_to_context(self.videoCodecContext,
                                     codecPar);

       self.videoCodecContext->thread_count = 4;
       NSString *description = [NSString stringWithUTF8String:decoderCodec->long_name];

       // 2. Open codec.
       if (avcodec_open2(self.videoCodecContext, decoderCodec, NULL) < 0)
       {
           // Create approp error.
           return error;
       }

       // * Audio codec setup:
       if (self.selectedAudioStreamIndex > -1)
       {
           [self setupAudioDecoder];
       }

       // Allocate a raw video frame data structure. Contains audio and video data.
       self.rawFrameData = av_frame_alloc();

       self.outputWidth = self.videoCodecContext->width;
       self.outputHeight = self.videoCodecContext->height;

       if (!isInitProcess)
       {
           // Triggering notifications in init process won't change UI since the object is created locally. All
           // objects which need data access to this object will not be able to get it. Thats why we don't notifiy anyone about the changes.
           [NSNotificationCenter.defaultCenter postNotificationName:NSNotification.rtspVideoStreamSelectionChanged
                                                             object:nil userInfo: self.selectedVideoStream];

           [NSNotificationCenter.defaultCenter postNotificationName:NSNotification.rtspAudioStreamSelectionChanged
                                                             object:nil userInfo: self.selectedAudioStream];
       }

       return nil;
    }

    UPDATE 1

    The initial architecture allowed using any given thread. Most of the below code would mostly run on the main thread. This solution was not appropriate since the opening of the stream input can take several seconds for which the main thread is blocked while waiting for a network response inside FFmpeg. To solve this issue I have implemented the following solution :

    • Creation and the initial setup are only allowed on the background_thread (see code snippet "1" below).
    • Changes are allowed on the current_thread(Any).
    • Termination is allowed on the current_thread(Any).

    After removing main thread checks and dispatch_asyncs to background threads, leaking has stopped and I can’t reproduce the issue anymore :

    // Code that produces the issue.  
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
       // 1 - Create and do initial setup.
       // This block creates the issue.
    [self.rtspObject = [[RTSPObject alloc] initWithURL: ... ];
    [self.rtspObject openInputStreamWithVideoStreamId: ...
                                   audioStreamId: ...
                                        useFirst: ...
                                          inInit: ...];
    });

    I still don’t understand why Xcode’s memory debugger says that this block is retained ?

    Any advice or idea is welcome.

  • I detected an error downloading a twitch tv stream. I use ffmpeg. That error stops the download, how can I fix it ? [closed]

    9 juin, par sort35ofn

    I wanted to perform a download via ffmpeg of a video streamed live on the Twitch tv platform. I have windows 10 and I use cmd to run ffmpeg.

    


    The command I use to download the concert is :

    


    ffmpeg.exe -i "m3u8-link" -c copy name.ts


    


    I once downloaded with yt-dlp, but noticed that the quality was noticeably lower, at least using the following command :
yt-dlp.exe -f (bestvideo+bestaudio/best) "amazon-channel-link"

    


    That's why I prefer to download with ffmpeg. Normally I haven't had any problems with downloads. But this is already the third time (not continuously/consecutively) that I get this error. That error causes the download of the stream to terminate. It is not like in other occasions that sometimes a .ts fragment (of 3 seconds, for example) has already expired (and is not included in the download) but the download continues.

    


    [https @ 000001edada180c0] Opening 'https://sae12.playlist.ttvnw.net/v1/playlist/Cr4GlKuutNM7CxfM9Sq0mdUFxA8uA3F2oluPaJOmOPaBjmTkdiv4RxnkTtt_tEV8t2CyuH6D1E0HB3Erpbjq3mCfV5KqO4GfOMNOElmyYe2AKZcyQJHNeavrFfVBPB_pbDS5PYWTzUHoS0iTLfmn2cx-wHMHXa5MO-IdGPRixWDvezKNhOebWYscoIWvYwstshPSFvem1EN1UES7QfIDHSlBcZF3lGeVpg2yl05dhVwAX8YI9rnBtXYbwAUwcjEmPiqk_wm6oEX-2LRsw_05dznnVv6BbyYsLvyZu810xt9BNQU6rNCSzuoZhVx8gFxoyEdUt-VV3L_xj78-5CFibrvnO4uCafCZ5-wE_bEtUQeuHsLmm9Qf9Pj5BIGB2BHWm2LqlGTHcDG-8Z0u1-3_FB_h7fN7-uuyN-6-lreZYHDPviM8hKHFMU3zwNY29elgKRPgVMJ-4ysLWGuOPdwrylJpLFJSzsXhZaEE4p_4Zg6gfDuozYYttmPI2G1LErd5p1lT9DkQncFZibymap5Fiv-x21-jeNbrZo92PfW7lIo6NPdlnPWyoUTOb2KjgU9R0fm1UJt1kQJmQMVyDN2OHZ4t7dcAfyGMTwU26O7DdaYZhhv8mPMteBZcyjnLKH7e5AMtHUEVO2r9QIOiH0wDLNh-f9WS2kmRdJENBvl5mMGdyVHhBc9K9G5SuxBesi6F_9P_8agwpPo51m8ikJvSVJKduoIfVLSuto2SIe4DFI7hMxbplWfxBb1PNEoMWyeQd0iHUwDqQwVCFHq8OhGBp1EJtx1CNVtBhztLIqNXBbxR1Cdy8tx5rdJjq4EKlFKU3eh3_aRkhe7gulUKx2cZYNg4bGHpNBU1DP-std8xG1ckPdTpig-h_1okYPd7sXnynBFnhMHkVipsIJC4fkoT2MXHo3ItgMgTUBh1-oWD6qaD00VDM9TyDcCawJt-kI8-KnwlUkh7pq2cUv9ODqSjm5xcLoxPUxutCoZ9aKq9cnV0kqKPXxmLOekmgWK8G8MjFZ6Es5n46NeKREgQEBUTf2TZkUTOHZAiElyPy0ZdyOxFkdFZ06yqq8zUWG_dnhpgbrS1SueCOx5rGInRIdg94TIaDLMJTUvkLrqDdcS2jiABKgl1cy1lYXN0LTIwuAw.m3u8' for reading
[https @ 000001edad715600] HTTP error 500 Internal Server Errortrate=4480.2kbits/s speed=1.01x elapsed=0:17:30.76
[hls @ 000001edab89e500] keepalive request failed for 'https://sae12.playlist.ttvnw.net/v1/playlist/Cr4GlKuutNM7CxfM9Sq0mdUFxA8uA3F2oluPaJOmOPaBjmTkdiv4RxnkTtt_tEV8t2CyuH6D1E0HB3Erpbjq3mCfV5KqO4GfOMNOElmyYe2AKZcyQJHNeavrFfVBPB_pbDS5PYWTzUHoS0iTLfmn2cx-wHMHXa5MO-IdGPRixWDvezKNhOebWYscoIWvYwstshPSFvem1EN1UES7QfIDHSlBcZF3lGeVpg2yl05dhVwAX8YI9rnBtXYbwAUwcjEmPiqk_wm6oEX-2LRsw_05dznnVv6BbyYsLvyZu810xt9BNQU6rNCSzuoZhVx8gFxoyEdUt-VV3L_xj78-5CFibrvnO4uCafCZ5-wE_bEtUQeuHsLmm9Qf9Pj5BIGB2BHWm2LqlGTHcDG-8Z0u1-3_FB_h7fN7-uuyN-6-lreZYHDPviM8hKHFMU3zwNY29elgKRPgVMJ-4ysLWGuOPdwrylJpLFJSzsXhZaEE4p_4Zg6gfDuozYYttmPI2G1LErd5p1lT9DkQncFZibymap5Fiv-x21-jeNbrZo92PfW7lIo6NPdlnPWyoUTOb2KjgU9R0fm1UJt1kQJmQMVyDN2OHZ4t7dcAfyGMTwU26O7DdaYZhhv8mPMteBZcyjnLKH7e5AMtHUEVO2r9QIOiH0wDLNh-f9WS2kmRdJENBvl5mMGdyVHhBc9K9G5SuxBesi6F_9P_8agwpPo51m8ikJvSVJKduoIfVLSuto2SIe4DFI7hMxbplWfxBb1PNEoMWyeQd0iHUwDqQwVCFHq8OhGBp1EJtx1CNVtBhztLIqNXBbxR1Cdy8tx5rdJjq4EKlFKU3eh3_aRkhe7gulUKx2cZYNg4bGHpNBU1DP-std8xG1ckPdTpig-h_1okYPd7sXnynBFnhMHkVipsIJC4fkoT2MXHo3ItgMgTUBh1-oWD6qaD00VDM9TyDcCawJt-kI8-KnwlUkh7pq2cUv9ODqSjm5xcLoxPUxutCoZ9aKq9cnV0kqKPXxmLOekmgWK8G8MjFZ6Es5n46NeKREgQEBUTf2TZkUTOHZAiElyPy0ZdyOxFkdFZ06yqq8zUWG_dnhpgbrS1SueCOx5rGInRIdg94TIaDLMJTUvkLrqDdcS2jiABKgl1cy1lYXN0LTIwuAw.m3u8' with error: 'Server returned 5XX Server Error reply' when parsing playlist
[https @ 000001edad714900] HTTP error 500 Internal Server Errortrate=4480.2kbits/s speed=   1x elapsed=0:17:32.82
[hls @ 000001edab89e500] Failed to reload playlist 0
[https @ 000001edab8a4dc0] Opening 'https://c513a515af41.chantenay.akamai.hls.ttvnw.net/v1/segment/CvUCxQ8TAK7dXfVU_OB77Tl0jy4jVuXiNgXG_97z6zGC4vXLrJNkgegJgVTcnrjyxZuL37UAeKJ9nhR48Yq2YRy_r8EnJ3PyAX407Gj21HDw3AG1KFXL-Z1ysn7DFTvOb434uA_farXGB276wYH-n0dFr7TzD7G2sCLcYSZeyadGEwJbq3wvb7AglP8UEU0JxwZRVKWx0zX9Vd4I3EiSdAUP7w96T75UBwreFKwxvq16-od59YpbneYRYUYkgKEZSLTgrmCkm_nN4FWxOCSOhFHqHmjCenSREMJMdSHbhcqgvU5pdIxSm0ITMAxY4jX6cUTFKsqYGeKwCMHjy0gptCuPGVvEJCffxq00YNmF194USBRWumBZCp0TuRtI4LzjyPB1LARLdzJ56bCibI6lRE4hDn53zAV5ZUcWlkUIuUJ52D4vH3fRl85AQHV8UiWl8MEfyjJ4B8XxThp7lZ8nhAX42pUJ_8YgaK6BO51syG2Rkm9icm8ddRoM8pDl2Pkp8FgFncdIIAEqCXVzLWVhc3QtMjC4DA.ts?dna=CnWfUp8FT0O95nMtHpmzX-0LudnQmJLc-YARNX594okBXpxNtNQOAoOFUhTgI3_AReiOPiW_1e2e3oeoXJfoJbH4KZniEQhFhSWU7wMaSzM8CkZomzvn1Gig5l71lY9wSw8DV-QRh6LK7zfRqp5yy547EAFTbcwaDDnujf_TZXo1TVET8CABKgl1cy1lYXN0LTIwuAw' for reading
[https @ 000001edad4be180] Opening 'https://c513a515af41.chantenay.akamai.hls.ttvnw.net/v1/segment/CvUCvDoClU0qVRu8zB4Vm0gdhBMUSkOd9X-6zOlmLSLjAZDs-Oxj_mW5vBJWinuwpM4xU4bDToC8hfj7Xv80h6Rc93voJNaNiUxYWszEFu1AJh-_LsqxEJA-3nW8MBNo9YeaecC_EX8TF0VTaVBGiLI1SQNREb-1B5pAkYXfVcO_OSI2QqrssKXbBzkNwsx6dW38ir7CNT9qTZACJGzDZkxXYrSlArubviw_wXxSKXQKn0YcF3yXeKO4iXHRjkyrX0rnaSM3PRDJhr1xGT47u9J5jymTL55O9QRLS-9Z8ZN1LhqpXLxBFJbFi-4v_yJZWponNmS3F6b3rMhW3WCv5qw96B4UHF7NjFJWk0LmyLTkNcBAPC2yyARDZ02MoIXPzMSEq9Z1O4jrASPj34HXA_8BdxqZdVtyzjEekR2ThJkueLyFshQ3HIGkeFH49xpQmDNgE93VovfMACG9RTUCIPP9cZuOhTkoFBpT7JSrOx_p2oS3q4QiYxoMQNuunEN7QhQW4OPMIAEqCXVzLWVhc3QtMjC4DA.ts?dna=CnWfUp8FT0O95nMtHpmzX-0LudnQmJLc-YARNX594okBXpxNtNQOAoOFUhTgI3_AReiOPiW_1e2e3oeoXJfoJbH4KZniEQhFhSWU7wMaSzM8CkZomzvn1Gig5l71lY9wSw8DV-QRh6LK7zfRqp5yy547EAFTbcwaDDnujf_TZXo1TVET8CABKgl1cy1lYXN0LTIwuAw' for reading
[in#0/hls @ 000001edab89e3c0] Error during demuxing: Server returned 5XX Server Error reply 1x elapsed=0:17:33.34
[out#0/mpegts @ 000001edab92e880] video:547017KiB audio:12398KiB subtitle:0KiB other streams:0KiB global headers:0KiB muxing overhead: 3.451806%
frame=26450 fps= 25 q=-1.0 Lsize=  578726KiB time=00:17:37.96 bitrate=4481.2kbits/s speed=   1x elapsed=0:17:33.35

yt-dlp>


    


    Is there any way to prevent this error ? Or can I do something so that the download does not stop because of this error ?

    


    And excuse me but I forgot to take a screenshot of the cmd screen, so I don't remember the colors of the letters (it certainly changed the colors of the letters when the error appeared). So I proceed to indicate that the error starts when it says : “ [hls @ 000001edab89e500] keepalive request failed for ”.

    


  • How can I mux a MKV and MKA file and get it to play in a browser ?

    28 juin 2017, par Robert

    I’m using ffmpeg to merge .mkv and .mka files into .mp4 files. My current command looks like this :

    ffmpeg -i video.mkv -i audio.mka output_path.mp4

    The audio and video files are pre-signed urls from Amazon S3. Even on a server with sufficient resources, this process is going very slowly. I’ve researched situations where you can tell ffmpeg to skip re-encoding each frame, but I think that in my situation it actually does need to re-encode each frame.

    I’ve downloaded 2 sample files to my macbook pro and have installed ffmpeg locally via homebrew. When I run the command

    ffmpeg -i video.mkv -i audio.mka -c copy output.mp4

    I get the following output :

    ffmpeg version 3.3.2 Copyright (c) 2000-2017 the FFmpeg developers
     built with Apple LLVM version 8.1.0 (clang-802.0.42)
     configuration: --prefix=/usr/local/Cellar/ffmpeg/3.3.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-vda
     libavutil      55. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libavresample   3.  5.  0 /  3.  5.  0
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    Input #0, matroska,webm, from '319_audio_1498590673766.mka':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2017-06-27T19:10:58.000000Z
     Duration: 00:00:03.53, start: 2.831000, bitrate: 50 kb/s
       Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
       Metadata:
         title           : Audio
    Input #1, matroska,webm, from '319_video_1498590673766.mkv':
     Metadata:
       encoder         : GStreamer matroskamux version 1.8.1.1
       creation_time   : 2017-06-27T19:10:58.000000Z
     Duration: 00:00:03.97, start: 2.851000, bitrate: 224 kb/s
       Stream #1:0(eng): Video: vp8, yuv420p(progressive), 640x480, SAR 1:1 DAR 4:3, 30 tbr, 1k tbn, 1k tbc (default)
       Metadata:
         title           : Video
    [mp4 @ 0x7fa4f0806800] Could not find tag for codec vp8 in stream #0, codec not currently supported in container
    Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
    Stream mapping:
     Stream #1:0 -> #0:0 (copy)
     Stream #0:0 -> #0:1 (copy)
       Last message repeated 1 times

    So it appears that the specific encodings I’m working with are vp8 videos and opus audio files, which I believe are incompatible with the .mp4 output container. I would appreciate answers that cover ways of optimally merging vp8 and opus into .mp4 output or answers that point me in the direction of output media formats that are both compatible with vp8 & opus and are playable on web and mobile devices so that I can bypass the re-encoding step altogether.

    EDIT :

    Just wanted to provide a benchmark after following LordNeckbeard’s advice :

    4 min 41 second video transcoded locally on my mac

    LordNeckbeard’s approach : 15 mins 55 seconds (955 seconds)
    Current approach : 18 mins 49 seconds (1129 seconds)

    18% speed increase