Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (70)

  • 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.

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Changer son thème graphique

    22 février 2011, par

    Le thème graphique ne touche pas à la disposition à proprement dite des éléments dans la page. Il ne fait que modifier l’apparence des éléments.
    Le placement peut être modifié effectivement, mais cette modification n’est que visuelle et non pas au niveau de la représentation sémantique de la page.
    Modifier le thème graphique utilisé
    Pour modifier le thème graphique utilisé, il est nécessaire que le plugin zen-garden soit activé sur le site.
    Il suffit ensuite de se rendre dans l’espace de configuration du (...)

Sur d’autres sites (12562)

  • FFmpeg c api create encoder for AV_CODEC_ID_H264 crash on Windows

    30 avril 2023, par Guanyuming He

    I'm using ffmpeg (version 5.1.2) to clip a mp4 video per frame so I need to decode and encode it. However, when I'm creating the encoder for its video stream, the program always crashes at the call to avio_open2(), after H264 gives this error message :

    


    [h264_mf @ 0000025C1EBC1900] could not set output type (80004005)


    


    enter image description here

    


    The configuration (time_base, pix_fmt, width, height) of the codec context of the encoder is copied from the decoder, and I checked if the pixel format is supported by finding if it's in codec->pix_fmts.

    


    I find that the problem does not involve all my other pieces of code, because this minimal program can duplicate the same problem :

    


    extern "C"&#xA;{&#xA;#include <libavcodec></libavcodec>avcodec.h>&#xA;}&#xA;&#xA;int main()&#xA;{&#xA;    auto codec = avcodec_find_encoder(AV_CODEC_ID_H264);&#xA;    auto codec_ctx = avcodec_alloc_context3(codec);&#xA;&#xA;    codec_ctx->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;    codec_ctx->width = 2560;&#xA;    codec_ctx->height = 1440;&#xA;    codec_ctx->time_base.num = 1; codec_ctx->time_base.den = 180000;&#xA;&#xA;    avcodec_open2(codec_ctx, codec, NULL);&#xA;&#xA;    return 0;&#xA;}&#xA;

    &#xA;

    Then I suspect if it's a bug of ffmpeg. My environment is Windows 11 64-bit, Visual Studio 2022. The ffmpeg library is obtained from vcpkg, as shown in the following image :

    &#xA;

    enter image description here

    &#xA;

  • Playing RTP stream on Android 4.1.2 (Jelly Bean) [closed]

    27 décembre 2024, par Homie_Tomie

    I'll try to keep it quick. Using FFMPEG I started a stream on my PC. Here is the code :

    &#xA;

    import subprocess&#xA;&#xA;def start_stream():&#xA;    command = [&#xA;        &#x27;ffmpeg&#x27;,&#xA;        &#x27;-f&#x27;, &#x27;gdigrab&#x27;,  # Desktop capture (Windows)&#xA;        &#x27;-framerate&#x27;, &#x27;15&#x27;,  # Low framerate for higher performance&#xA;        &#x27;-i&#x27;, &#x27;desktop&#x27;,  # Capture desktop&#xA;        &#x27;-c:v&#x27;, &#x27;libx264&#x27;,  # Video codec (H.264)&#xA;        &#x27;-preset&#x27;, &#x27;ultrafast&#x27;,  # Ultra-fast encoding preset for minimal latency&#xA;        &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,  # Zero latency for real-time streaming&#xA;        &#x27;-x264opts&#x27;, &#x27;keyint=15:min-keyint=15:no-scenecut&#x27;,  # Frequent keyframes&#xA;        &#x27;-b:v&#x27;, &#x27;500k&#x27;,  # Low bitrate to minimize data usage and reduce latency&#xA;        &#x27;-s&#x27;, &#x27;800x480&#x27;,  # Resolution fits phone screen and helps performance&#xA;        &#x27;-max_delay&#x27;, &#x27;0&#x27;,  # No buffering, instant frame output&#xA;        &#x27;-flush_packets&#x27;, &#x27;1&#x27;,  # Flush packets immediately after encoding&#xA;        &#x27;-f&#x27;, &#x27;rtp&#x27;,  # Use mpegts as the container for RTP stream&#xA;        &#x27;rtp://192.168.72.26:1234&#x27;,  # Stream over UDP to localhost on port 1234&#xA;        &#x27;-sdp_file&#x27;, &#x27;stream.sdp&#x27;  # Create SDP file&#xA;    ]&#xA;    &#xA;    try:&#xA;        print("Starting stream...")&#xA;        subprocess.run(command, check=True)&#xA;    except subprocess.CalledProcessError as e:&#xA;        print(f"Error occurred: {e}")&#xA;    except KeyboardInterrupt:&#xA;        print("\nStream interrupted")&#xA;&#xA;if __name__ == "__main__":&#xA;    print("Starting screen capture...")&#xA;    start_stream()&#xA;

    &#xA;

    Now, when I start the stream I can connect to it in VLC when I open up the stream.sdp file. Using the same method I can open up the stream on my iPhone, but when I try to open it on my old Android phone the stream connects but the screen is black. However, when I turn the screen I can see the first frame that was sent to the phone. Why does the stream not work ?

    &#xA;

    I will be thankful for any and all advice :)

    &#xA;

  • iOS Radio App : Need to extract and stream audio-only from HLS streams with video content

    20 décembre 2024, par Bader Alghamdi

    I'm developing an iOS radio app that plays various HLS streams. The challenge is that some stations broadcast HLS streams containing both audio and video (example : https://svs.itworkscdn.net/smcwatarlive/smcwatar/chunks.m3u8), but I want to :

    &#xA;

    Extract and play only the audio track&#xA;Support AirPlay for audio-only streaming&#xA;Minimize data usage by not downloading video content&#xA;Technical Details :

    &#xA;

    iOS 17+&#xA;Swift 6&#xA;Using AVFoundation for playback&#xA;Current implementation uses AVPlayer with AVPlayerItem&#xA;Current Code Structure :

    &#xA;

    class StreamPlayer: ObservableObject { @Published var isPlaying = false private var player: AVPlayer? private var playerItem: AVPlayerItem?&#xA;&#xA;func playStream(url: URL) {&#xA;    let asset = AVURLAsset(url: url)&#xA;    playerItem = AVPlayerItem(asset: asset)&#xA;    player = AVPlayer(playerItem: playerItem)&#xA;    player?.play()&#xA;}&#xA;&#xA;

    &#xA;

    Stream Analysis : When analyzing the video stream using FFmpeg :

    &#xA;

    CopyInput #0, hls, from &#x27;https://svs.itworkscdn.net/smcwatarlive/smcwatar/chunks.m3u8&#x27;:&#xA;  Stream #0:0: Video: h264, yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps&#xA;  Stream #0:1: Audio: aac, 44100 Hz, stereo, fltp&#xA;&#xA;

    &#xA;

    Attempted Solutions :

    &#xA;

    Using MobileFFmpeg :

    &#xA;

    let command = [&#xA;    "-i", streamUrl,&#xA;    "-vn",&#xA;    "-acodec", "aac",&#xA;    "-ac", "2",&#xA;    "-ar", "44100",&#xA;    "-b:a", "128k",&#xA;    "-f", "mpegts",&#xA;    "udp://127.0.0.1:12345"&#xA;].joined(separator: " ")&#xA;&#xA;ffmpegProcess = MobileFFmpeg.execute(command)&#xA;&#xA;I&#xA;

    &#xA;

    ssue : While FFmpeg successfully extracts audio, playback through AVPlayer doesn't work reliably.

    &#xA;

    Tried using HLS output :

    &#xA;

    let command = [&#xA;    "-i", streamUrl,&#xA;    "-vn",&#xA;    "-acodec", "aac",&#xA;    "-ac", "2",&#xA;    "-ar", "44100",&#xA;    "-b:a", "128k",&#xA;    "-f", "hls",&#xA;    "-hls_time", "2",&#xA;    "-hls_list_size", "3",&#xA;    outputUrl.path&#xA;]&#xA;&#xA;

    &#xA;

    Issue : Creates temporary files but faces synchronization issues with live streams.

    &#xA;


    &#xA;

    Testing URLs :

    &#xA;

    Audio+Video : https://svs.itworkscdn.net/smcwatarlive/smcwatar/chunks.m3u8&#xA;Audio Only : https://mbcfm-radio.mbc.net/mbcfm-radio.m3u8

    &#xA;


    &#xA;

    Requirements :

    &#xA;

      &#xA;
    • Real-time audio extraction from HLS stream
    • &#xA;

    • Maintain live streaming capabilities
    • &#xA;

    • Full AirPlay support
    • &#xA;

    • Minimal data usage (avoid downloading video content)
    • &#xA;

    • Handle network interruptions gracefully
    • &#xA;

    &#xA;

    Questions :

    &#xA;

      &#xA;
    • What's the most efficient way to extract only audio from an HLS stream in real-time ?
    • &#xA;

    • Is there a way to tell AVPlayer to ignore video tracks completely ?
    • &#xA;

    • Are there better alternatives to FFmpeg for this specific use case ?
    • &#xA;

    • What's the recommended approach for handling AirPlay with modified streams ?
    • &#xA;

    &#xA;

    Any guidance or alternative approaches would be greatly appreciated. Thank you !

    &#xA;

    What I Tried :

    &#xA;

      &#xA;
    1. Direct AVPlayer Implementation :
    2. &#xA;

    &#xA;

      &#xA;
    • Used standard AVPlayer to play HLS stream
    • &#xA;

    • Expected it to allow selecting audio-only tracks
    • &#xA;

    • Result : Always downloads both video and audio, consuming unnecessary bandwidth
    • &#xA;

    &#xA;


    &#xA;
      &#xA;
    1. FFmpeg Audio Extraction :
    2. &#xA;

    &#xA;

    let command = [&#xA;    "-i", "https://svs.itworkscdn.net/smcwatarlive/smcwatar/chunks.m3u8",&#xA;    "-vn",                    // Remove video&#xA;    "-acodec", "aac",        // Audio codec&#xA;    "-ac", "2",              // 2 channels&#xA;    "-ar", "44100",          // Sample rate&#xA;    "-b:a", "128k",          // Bitrate&#xA;    "-f", "mpegts",          // Output format&#xA;    "udp://127.0.0.1:12345"  // Local stream&#xA;]&#xA;ffmpegProcess = MobileFFmpeg.execute(command)&#xA;&#xA;

    &#xA;

    Expected : Clean audio stream that AVPlayer could play&#xA;Result : FFmpeg extracts audio but AVPlayer can't play the UDP stream

    &#xA;


    &#xA;
      &#xA;
    1. HLS Segmented Approach :
    2. &#xA;

    &#xA;

    swiftCopylet command = [&#xA;    "-i", streamUrl,&#xA;    "-vn",&#xA;    "-acodec", "aac",&#xA;    "-f", "hls",&#xA;    "-hls_time", "2",&#xA;    "-hls_list_size", "3",&#xA;    outputUrl.path&#xA;]&#xA;&#xA;

    &#xA;

    Expected : Create local HLS playlist with audio-only segments&#xA;Result : Creates files but faces sync issues with live stream

    &#xA;


    &#xA;

    Expected Behavior :

    &#xA;

      &#xA;
    • Stream plays audio only
    • &#xA;

    • Minimal data usage (no video download)
    • &#xA;

    • Working AirPlay support
    • &#xA;

    • Real-time playback without delays
    • &#xA;

    &#xA;

    Actual Results :

    &#xA;

      &#xA;
    • Either downloads full video stream (wasteful)
    • &#xA;

    • Or fails to play extracted audio
    • &#xA;

    • AirPlay issues with modified streams
    • &#xA;

    • Sync problems with live content
    • &#xA;

    &#xA;