Recherche avancée

Médias (1)

Mot : - Tags -/biomaping

Autres articles (81)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

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

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

Sur d’autres sites (9825)

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

    


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

    


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

    


    class StreamPlayer: ObservableObject { @Published var isPlaying = false private var player: AVPlayer? private var playerItem: AVPlayerItem?

func playStream(url: URL) {
    let asset = AVURLAsset(url: url)
    playerItem = AVPlayerItem(asset: asset)
    player = AVPlayer(playerItem: playerItem)
    player?.play()
}



    


    Stream Analysis : When analyzing the video stream using FFmpeg :

    


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



    


    Attempted Solutions :

    


    Using MobileFFmpeg :

    


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

ffmpegProcess = MobileFFmpeg.execute(command)

I


    


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

    


    Tried using HLS output :

    


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



    


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

    



    


    Testing URLs :

    


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

    



    


    Requirements :

    


      

    • Real-time audio extraction from HLS stream
    • 


    • Maintain live streaming capabilities
    • 


    • Full AirPlay support
    • 


    • Minimal data usage (avoid downloading video content)
    • 


    • Handle network interruptions gracefully
    • 


    


    Questions :

    


      

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


    • Is there a way to tell AVPlayer to ignore video tracks completely ?
    • 


    • Are there better alternatives to FFmpeg for this specific use case ?
    • 


    • What's the recommended approach for handling AirPlay with modified streams ?
    • 


    


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

    


    What I Tried :

    


      

    1. Direct AVPlayer Implementation :
    2. 


    


      

    • Used standard AVPlayer to play HLS stream
    • 


    • Expected it to allow selecting audio-only tracks
    • 


    • Result : Always downloads both video and audio, consuming unnecessary bandwidth
    • 


    



    

      

    1. FFmpeg Audio Extraction :
    2. 


    


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



    


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

    



    

      

    1. HLS Segmented Approach :
    2. 


    


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



    


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

    



    


    Expected Behavior :

    


      

    • Stream plays audio only
    • 


    • Minimal data usage (no video download)
    • 


    • Working AirPlay support
    • 


    • Real-time playback without delays
    • 


    


    Actual Results :

    


      

    • Either downloads full video stream (wasteful)
    • 


    • Or fails to play extracted audio
    • 


    • AirPlay issues with modified streams
    • 


    • Sync problems with live content
    • 


    


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

    


    import subprocess

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

if __name__ == "__main__":
    print("Starting screen capture...")
    start_stream()


    


    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 ?

    


    I will be thankful for any and all advice :)

    


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