Recherche avancée

Médias (0)

Mot : - Tags -/tags

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (72)

Sur d’autres sites (9360)

  • FFMPEG pushed RTMP stream not working on Android & iPhone

    1er décembre 2015, par BlackDivine

    I have to make a semi-live-stream. I used Nginx-rtmp module and then pushed content to it via ffmpeg using :

    ffmpeg -re -i content.mp4 -r 25 -f fvl "rtmp://rtmp.server.here"

    The stream runs fine when I open it in VLC from "rtmp ://rtmp.server.here"

    But I also have to make iPhone and Android apps that play these streams. And that’s the problem, the stream doesn’t work on Android and iPhone.

    If I use Wowza streaming cloud and stream to Wowza cloud instead of my own nginx-rtmp server then the same app written for Android & iPhone can playback the stream just fine.

    Now either nginx-rtmp is not working right, or what else ? I’ve also tried crtmpserver and the same thing happens.

    What I want to acheive :
    I have to develop a system where we can upstream a TV-Channel (have rights for it) to a server and then make a website, android app & iPhone app so consumers can watch the live channel.

    The uploading part I have a clue of, probably a TV tuner card and Open Broadcast Software to stream it to server. But the Live playback is new to me.


    UPDATE : I also used ffprobe and here’s the output. (See the last line)

    munir@munir-HP-ProBook-450-G2:~$ ffprobe rtmp://rtmp.server.here
    ffprobe version 2.6.2 Copyright (c) 2007-2015 the FFmpeg developers
     built with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
     configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
     libavutil      54. 20.100 / 54. 20.100
     libavcodec     56. 26.100 / 56. 26.100
     libavformat    56. 25.101 / 56. 25.101
     libavdevice    56.  4.100 / 56.  4.100
     libavfilter     5. 11.102 /  5. 11.102
     libavresample   2.  1.  0 /  2.  1.  0
     libswscale      3.  1.101 /  3.  1.101
     libswresample   1.  1.100 /  1.  1.100
     libpostproc    53.  3.100 / 53.  3.100
    [flv @ 0x267cc60] Stream discovered after head already parsed
       Last message repeated 1 times
    Input #0, flv, from 'rtmp://stage.funworldpk.com/live':
     Metadata:
       Server          : NGINX RTMP (github.com/arut/nginx-rtmp-module)
       displayWidth    : 320
       displayHeight   : 240
       fps             : 20
       profile         :
       level           :
     Duration: 00:00:00.00, start: 288.763000, bitrate: N/A
       Stream #0:0: Video: h264 (High), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 20 fps, 20 tbr, 1k tbn, 40 tbc
       Stream #0:1: Data: none
       Stream #0:2: Audio: aac (LC), 22050 Hz, stereo, fltp
    Unsupported codec with id 0 for input stream 1

    Update 2 :
    I got my stream working by using Licensed copy of Wowza streaming server. Everything works now. But obviously this will not be an option for everyone that’s why I am not posting it as an answer.

  • Recording audio with MediaRecorder on iPhone with Safari and Chrome only 1 second long ? Mimetype and FFMPEG problem ?

    9 mai 2023, par Avatar

    I am using MediaRecorder to record the Microphone audio on a website.

    


    Javascript :

    


    var blob;
var blob_url;
var stream;
var recorder;
var chunks;

var media = {
    tag: 'audio',
    type: 'audio/ogg',
    ext: '.ogg',
    gUM: {audio: true}
};

navigator.mediaDevices.getUserMedia(media.gUM).then(_stream => 
{
    stream = _stream;

    recorder = new MediaRecorder(stream);

    recorder.ondataavailable = e => 
    {
        // push data to chunks
        chunks.push(e.data);

        // recording has been stopped
        if(recorder.state == 'inactive') 
        {
            // audio data available
            blob = new Blob(chunks, {type: media.type });
            blob_url = URL.createObjectURL(blob);
            
            // send data to server
            uploadfile_audio();
        }
    };

    if(typeof(recorder)=='undefined')
    {
        alert('No microphone access');
        return;
    }

    chunks = [];
    recorder.start();
}


// when stop button is clicked
recorder.stop();
stream.getTracks().forEach( track => track.stop() );


    


    The audio stream (ogg format) is sent to the server.

    


    Since iPad/iPhone do not play ogg files, the recording file is converted to "mp3" using FFMPEG.

    


    This file is stored on the server.

    

    


    This works on Windows and MAC (Chrome and Safari), also on iPad (Safari) but not properly on iPhone (Chrome/Safari). Version : iPhone iOS 15.1.

    


    On iPhone the recording file is only 0:01 min in length. Size is always 17277 Bytes.

    


    What could be the issue ? (I cannot debug because I don't have a Mac.)

    


    Does the stream get interrupted ? Is the recording stopped after 1 second ?

    


    Update 1 :

    


    I have checked the incoming filesize of the browser-recorded file serverside. It seems to be coming in properly, because there are different sizes such as 184 kB.

    


    My guess is now that FFMPEG cannot handle the incoming file correctly. Which might have the wrong mimetype set in Javascript with type: 'audio/ogg',. Is another format needed ?

    


    The conversion code serverside :

    


    PHP

    


    $mp3file = shell_exec("ffmpeg -i ".$file_locationtmp." -vn -ar 44100 -ac 2 -b:a 128k ".$file_locationtmp.".mp3");


    


    I would need to find out the audio recording format used by iPhone but I couldn't.

    


    I tried to find the supporting mimetypes using https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/isTypeSupported - however, it shows that NO mimetypes are supported on iPhone (neither in Chrome nor Safari).

    


    Update 2 :

    


    I used ffprobe to get the recording file information. It says Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 2234 kb/s (default)

    


    Update 3 :

    


    It seems to be a problem with FFMPEG. See my new question How to convert AAC/MP4A to MP3 using FFMPEG in full length ? Audio file gets cut off after 1 second

    


  • Revised FATE Test Spec System

    9 juin 2010, par Multimedia Mike — FATE Server

    FATE involves some database tables that define the test specifications. Like everything else in FATE, the concept could use some improvement. After I prototyped an improved, multithreaded testing client, the next logical revision seemed to be the test spec system.

    History
    The test spec system has been handled by a single table that includes an FFmpeg command line (with a few possible modifiers thrown in), an integer ID, a human-friendly ID, a description, the expected command line return code, the expected command output, a maximum runtime, and a Boolean to indicate whether the test is to be considered active.

    Adjunct to this test database is a large corpus of test media named the FATE suite.

    At first, the FATE testing script used a direct MySQL database protocol to query the test specs from the server before every build/test cycle. I soon realized this was ludicrously inefficient since the test specs don’t change that often. So I cached the tests in a static file to be retrieved via HTTP, first in Python’s "pickled" (serialized) format, then in an SQLite database.

    Planned Upgrades
    There are 2 major features I would like to build into the system going forward :

    1. The ability to version the entire suite so that it’s possible to test old branches of FFmpeg
    2. Another database field to indicate which, if any, other test specs must be executed before this spec can be executed

    I think I will take this opportunity to switch the test cache serialization format to JSON. I switched from Python pickling to SQLite because the latter was more portable between languages. JSON has that same benefit. Further, working with JSON data doesn’t require a round trip to disk (i.e., want to generate an SQLite database for sending via HTTP ? It needs to go onto disk first. It’s possible to create and manipulate a database entirely in memory but not fetch the bits).

    Things To Research

    • Pondering how version control systems operate and what they have to teach regarding how to version this data (including the question of whether I can just use an existing version control mechanism instead of creating my own system)
    • Efficient caching mechanism
    • Tagging test specs for alternate purposes such as longevity testing
    • Learn about web form programming in the 21st century so that it’s not quite as painful to maintain the system.

    Preliminary Versioning Concept
    Here is one approach I am thinking of : Create test groups. Each test spec is assigned to at least one test group. I can think of at least 2 groups : functional (the base test set in existence that validates functionality) and profiling (the projected test set that will be used for ongoing performance and memory profiling). The web frontend will allow for the creation of labels that will apply to a single group. Doing so will apply that label to all active tests in the group.