Recherche avancée

Médias (91)

Autres articles (59)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • 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

Sur d’autres sites (8716)

  • Streaming Webcam from Windows 10 to Ubuntu 18.04 via WSL2 and usbip [closed]

    15 juin 2021, par Jacob Dallas

    Background
    
Alright so I was able to set up my Windows 10 desktop with WSL2 in order to run Ubuntu 18.04. I'm trying to get the webcam to be accessible and have picked and pieced together the following tutorials in order to get myself to where I am.

    


    


    The Why
    
"Why would you go through this painstaking effort ? Seems dumb." you might be telling yourself. Well I think that it's dumb that WSL2 doesn't have a USB pass-through, so there's that. But I develop on Windows traditionally, and with a recent computer vision project I'm undertaking that incorporates the Nvidia Isaac SDK (only available on Ubuntu 18.04) I was hoping to continue to use Windows to develop, and then Ubuntu 18.04 to test. I'm trying to stay away from dual booting because switching back and forth between OSs is time-consuming.

    


    Current State
    
What I'm able to do is pass through the web camera using usbip from windows using the following commands
    
.\usbip.exe bind -b 1-189
    
.\usbipd.exe -d -4

    


    and then on the linux side I connect it by running
    
sudo usbip attach --remote=172.30.64.1 --busid=1-220
    
except that I put in my own remote address and busid

    


    What that results in is the ability to see that the camera is attached and seen by linux, but no matter what program/library I use, none of them are able to open the webcam

    


    Here are some outputs from different commands people have used to display camera information :

    


    ~$ v4l2-ctl --list-devices 
Logitech Webcam C930e (usb-vhci_hcd.0-1):
    /dev/video0
    /dev/video1

~$ v4l-info /dev/video0

### v4l2 device info [/dev/video0] ###
general info
    VIDIOC_QUERYCAP
    driver                  : "uvcvideo"
    card                    : "Logitech Webcam C930e"
    bus_info                : "usb-vhci_hcd.0-1"
    version                 : 4.19.84
    capabilities            : 0x84a00001 [VIDEO_CAPTURE,?,?,STREAMING,(null)]

standards

inputs
    VIDIOC_ENUMINPUT(0)
    index                   : 0
    name                    : "Camera 1"
    type                    : CAMERA
    audioset                : 0
    tuner                   : 0
    std                     : 0x0 []
    status                  : 0x0 []

video capture
    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)
    index                   : 0
    type                    : VIDEO_CAPTURE
    flags                   : 0
    description             : "YUYV 4:2:2"
    pixelformat             : 0x56595559 [YUYV]
    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)
    index                   : 1
    type                    : VIDEO_CAPTURE
    flags                   : 1
    description             : "Motion-JPEG"
    pixelformat             : 0x47504a4d [MJPG]
    VIDIOC_G_FMT(VIDEO_CAPTURE)
    type                    : VIDEO_CAPTURE
    fmt.pix.width           : 640
    fmt.pix.height          : 480
    fmt.pix.pixelformat     : 0x56595559 [YUYV]
    fmt.pix.field           : NONE
    fmt.pix.bytesperline    : 1280
    fmt.pix.sizeimage       : 614400
    fmt.pix.colorspace      : SRGB
    fmt.pix.priv            : 4276996862

controls
    VIDIOC_QUERYCTRL(BASE+0)
    id                      : 9963776
    type                    : INTEGER
    name                    : "Brightness"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+1)
    id                      : 9963777
    type                    : INTEGER
    name                    : "Contrast"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+2)
    id                      : 9963778
    type                    : INTEGER
    name                    : "Saturation"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+12)
    id                      : 9963788
    type                    : BOOLEAN
    name                    : "White Balance Temperature, Auto"
    minimum                 : 0
    maximum                 : 1
    step                    : 1
    default_value           : 1
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+19)
    id                      : 9963795
    type                    : INTEGER
    name                    : "Gain"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 0
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+24)
    id                      : 9963800
    type                    : MENU
    name                    : "Power Line Frequency"
    minimum                 : 0
    maximum                 : 2
    step                    : 1
    default_value           : 2
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+26)
    id                      : 9963802
    type                    : INTEGER
    name                    : "White Balance Temperature"
    minimum                 : 2000
    maximum                 : 7500
    step                    : 1
    default_value           : 4000
    flags                   : INACTIVE
    VIDIOC_QUERYCTRL(BASE+27)
    id                      : 9963803
    type                    : INTEGER
    name                    : "Sharpness"
    minimum                 : 0
    maximum                 : 255
    step                    : 1
    default_value           : 128
    flags                   : unknown
    VIDIOC_QUERYCTRL(BASE+28)
    id                      : 9963804
    type                    : INTEGER
    name                    : "Backlight Compensation"
    minimum                 : 0
    maximum                 : 1
    step                    : 1
    default_value           : 0
    flags                   : unknown

~$ sudo ffmpeg -y -t 5 -f video4linux2  -i /dev/video0  out.mov
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
/dev/video0: Input/output error

~$ ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -frames 1 out.jpg
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
/dev/video0: Input/output error


    

    


    I'm not sure if I don't have a specific library, driver, random other thing, but everything I've tried so far seems to not solve the problem.

    
Question
    
Linux sees the web camera, knows that it is a web camera, but is not processing the camera feed. What would you recommend I do to be able to process the video feed ? I think this is an issue with my settings when I originally set up linux with menuconfig.
Any help would be appreciated :)

    


  • Problem recording RTP from mediasoup router using ffmpeg

    22 juin 2021, par Scramjet

    I have a mediasoup server setup where I now need recording feature. To accomplish this I am doing the following -
    
On getting the event to start recording I call this function :

    


    async handleStartRecording(peer, router)
    {
        let transports = [],
            consumers = [],
            ffmpegInput = {};
        for(let entry of peer.producers.entries())
        {
            const rtpTransport = await router.createPlainTransport({
                comedia: false,
                rtcpMux: false,
                listenIp: { ip: '127.0.0.1', announcedIp: null }
            });
            transports.push(rtpTransport);

            const port = (entry[1].kind === 'audio') ? 8994 : 8996;
            const rtcpPort = port+1;

            await rtpTransport.connect({
                ip: '127.0.0.1',
                port: port,
                rtcpPort: rtcpPort,
                rtcpMux: false
            });
            peer.addTransport(rtpTransport.id, rtpTransport);

            const rtpConsumer = await rtpTransport.consume({
                producerId: entry[0],
                rtpCapabilities: router.rtpCapabilities, 
                paused: true,
            });
            consumers.push(rtpConsumer);

            const codecs = [];
            const routerCodec = router.rtpCapabilities.codecs.find(
              codec => codec.kind === entry[1].kind
            );
            codecs.push(routerCodec);
            const rtpCapabilities = {
                codecs,
                rtcpFeedback: []
            };

            ffmpegInput[entry[1].kind] = {
                port,
                rtcpPort,
                localRtcpPort: rtpTransport.rtcpTuple ? rtpTransport.rtcpTuple.localPort : undefined,
                rtpCapabilities,
                rtpParameters: rtpConsumer.rtpParameters,
                preferredPayloadType: routerCodec.payloadType
            };
        }
        
        ffmpegInput.fileName = Date.now().toString();
        peer._process = new FFmpeg(ffmpegInput, consumers);
    }


    


    and the ffmpeg class is :

    


    class FFmpeg {
    constructor(rtpParameters, consumers) {
        this._rtpParameters = rtpParameters;
        this._consumers = consumers;
        this._process = undefined;
        this._createProcess();
    }
    _createProcess() {
        this._process = child_process.spawn('ffmpeg', this._commandArgs);
        consumers.forEach((consumer) =>
        {
            consumer.resume();
        });
    }
get _commandArgs() {
        let commandArgs = [
            '-loglevel',
            'debug',
            '-protocol_whitelist',
            'file,crypto,pipe,udp,rtp',
            '-fflags',
            '+genpts',
            '-i',
            '/recording/input-h264.sdp', //path to sdp file has full path this is sample
            '-map',            // video
            '0:v:0',
            '-c:v',
            'copy',
            '-map',            //audio
            '0:a:0',
            '-strict',
            '-2',
            '-c:a',
            'copy',
            '-f',
            'webm',
            '-flags',
            '+global_header',
            '-y',
            `/files/${this._rtpParameters.fileName}.webm`
        ]);
        return commandArgs;
    }
}



    


    Sdp file :

    


    v=0
o=- 0 0 IN IP4 127.0.0.1
s=FFmpeg
c=IN IP4 127.0.0.1
t=0 0
m=video 8996 RTP/AVPF 101
a=rtcp:8997
a=rtpmap:101 VP8/90000
a=fmtp:101 level-asymmetry-allowed=1
m=audio 8994 RTP/AVPF 100
a=rtcp:8995
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10;useinbandfec=1


    


    Now, I am getting a codec parameter not found for stream 0 error.

    


    createProcess() [sdpString:v=0
            o=- 0 0 IN IP4 127.0.0.1
            s=FFmpeg
            c=IN IP4 127.0.0.1
            t=0 0
            m=video 8996 RTP/AVP 101
            a=rtpmap:101 VP8/90000
            a=sendonly
            m=audio 8994 RTP/AVP 100
            a=rtpmap:100 opus/48000/2
            a=sendonly
            ]
commandArgs:[ '-analyzeduration',
  '2147483647',
  '-probesize',
  '2147483647',
  '-loglevel',
  'debug',
  '-protocol_whitelist',
  'file,crypto,pipe,udp,rtp',
  '-fflags',
  '+genpts',
  '-i',
  '/recording/input-h264.sdp',
  '-map',
  '0:v:0',
  '-c:v',
  'copy',
  '-map',
  '0:a:0',
  '-strict',
  '-2',
  '-c:a',
  'copy',
  '-f',
  'webm',
  '-flags',
  '+global_header',
  '-y',
  '/files/1623939179824.webm',
  [length]: 28 ]
ffmpeg::process::data(err) [data:ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
]
ffmpeg::process::data(err) [data:  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
]
ffmpeg::process::data(err) [data:  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libavresample   4.  0.  0 /  4.  0.  0
]
ffmpeg::process::data(err) [data:  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Splitting the commandline.
Reading option '-analyzeduration' ...]
ffmpeg::process::data(err) [data: matched as AVOption 'analyzeduration' with argument '2147483647'.
Reading option '-probesize' ...]
ffmpeg::process::data(err) [data: matched as AVOption 'probesize' with argument '2147483647'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-protocol_whitelist' ...]
ffmpeg::process::data(err) [data: matched as AVOption 'protocol_whitelist' with argument 'file,crypto,pipe,udp,rtp'.
Reading option '-fflags' ...]
ffmpeg::process::data(err) [data: matched as AVOption 'fflags' with argument '+genpts'.
Reading option '-i' ... matched as input url with argument '/recording/input-h264.sdp'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v:0'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-map' ...]
ffmpeg::process::data(err) [data: matched as option 'map' (set input stream mapping) with argument '0:a:0'.
Reading option '-strict' ...]
ffmpeg::process::data(err) [data:Routing option strict to both codec and muxer layer
 matched as AVOption 'strict' with argument '-2'.
Reading option '-c:a' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'webm'.
Reading option '-flags' ...]
ffmpeg::process::data(err) [data: matched as AVOption 'flags' with argument '+global_header'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/files/1623939179824.webm' ... matched as output url.
Finished splitting the commandline.
]
ffmpeg::process::data(err) [data:Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /recording/input-h264.sdp.
Successfully parsed a group of options.
Opening an input file: /recording/input-h264.sdp.
]
ffmpeg::process::data(err) [data:[NULL @ 0x55b7141c1a80] Opening '/recording/input-h264.sdp' for reading
]
ffmpeg::process::data(err) [data:[sdp @ 0x55b7141c1a80] Format sdp probed with size=2048 and score=50
]
ffmpeg::process::data(err) [data:[sdp @ 0x55b7141c1a80] video codec set to: vp8
[sdp @ 0x55b7141c1a80] audio codec set to: opus
[sdp @ 0x55b7141c1a80] audio samplerate set to: 48000
[sdp @ 0x55b7141c1a80] audio channels set to: 2
]
ffmpeg::process::data(err) [data:[udp @ 0x55b7141c4d40] end receive buffer size reported is 131072
[udp @ 0x55b7141cac00] end receive buffer size reported is 131072
[sdp @ 0x55b7141c1a80] setting jitter buffer size to 500
]
ffmpeg::process::data(err) [data:[udp @ 0x55b7141c5d40] end receive buffer size reported is 131072
]
ffmpeg::process::data(err) [data:[udp @ 0x55b7141c5e00] end receive buffer size reported is 131072
[sdp @ 0x55b7141c1a80] setting jitter buffer size to 500
]
ffmpeg::process::data(err) [data:[sdp @ 0x55b7141c1a80] Before avformat_find_stream_info() pos: 262 bytes read:262 seeks:0 nb_streams:2
]
ffmpeg::process::data(err) [data:[sdp @ 0x55b7141c1a80] Could not find codec parameters for stream 0 (Video: vp8, 1 reference frame, yuv420p): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
]
ffmpeg::process::data(err) [data:[sdp @ 0x55b7141c1a80] After avformat_find_stream_info() pos: 262 bytes read:262 seeks:0 frames:0
Input #0, sdp, from '/recording/input-h264.sdp':
  Metadata:
    title           : FFmpeg
  Duration: N/A, bitrate: N/A
    Stream #0:0, 0, 1/90000: Video: vp8, 1 reference frame, yuv420p, 90k tbr, 90k tbn, 90k tbc
    Stream #0:1, 0, 1/48000: Audio: opus, 48000 Hz, stereo, fltp
Successfully opened the file.
Parsing a group of options: output url /files/1623939179824.webm.
Applying option map (set input stream mapping) with argument 0:v:0.
Applying option c:v (codec name) with argument copy.
Applying option map (set input stream mapping) with argument 0:a:0.
]
ffmpeg::process::data(err) [data:Applying option c:a (codec name) with argument copy.
Applying option f (force format) with argument webm.
Successfully parsed a group of options.
Opening an output file: /files/1623939179824.webm.
]
ffmpeg::process::data(err) [data:[file @ 0x55b714243880] Setting default whitelist 'file,crypto'
]
ffmpeg::process::data(err) [data:Successfully opened the file.
]
ffmpeg::process::data(err) [data:[webm @ 0x55b71423e100] dimensions not set
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
    Last message repeated 1 times
[AVIOContext @ 0x55b714243b00] Statistics: 0 seeks, 0 writeouts
[AVIOContext @ 0x55b7141cacc0] Statistics: 262 bytes read, 0 seeks
]
ffmpeg::process::close


    


    I have been at it for days, I don't even know how to debug this issue. I tried using vlc's stream option with the url of server to check if the transport was working but it doesn't detect anything on localhost at that port.
    
If anyone has any ideas about the issue or ways to debug it, do tell me..

    


  • How can several .ts files be converted to one (non-fragmented) .mp4 file using ffmpeg ?

    23 juin 2021, par verified_tinker

    Problem Description

    


    The video player I'm using doesn't support .ts files, but it does play .mp4 files, so I'd like to use ffmpeg to convert my .ts files to .mp4 files.

    


    Goal Solution

    


    Use ffmpeg to download several .ts segments and transcode them into an .mp4 file that I'd load into my video player. Rinse and repeat. It'd add a delay of 10-20 seconds, but that's fine.

    


    The trick is to do the transcoding fast enough so, by the time one .mp4 file is finished playing, the next one is available ; in other words, the transcoding should take less than a second per second of footage. Ideally, it would take significantly less than that, to account for varying processing power on different devices.

    


    To clarify, when I say .mp4, I don't mean fragmented .mp4 files.

    



    


    If transcoding to some other format is faster, that might be fine, too. For example, I know the .mkv format is playable. I'm still exploring the full range of available formats.

    


    What I've Tried

    


    I tested transcoding 1 .ts file into an .mp4 file, and unfortunately it took about 6 seconds when the file was about 4 seconds long. That was with ffmpeg-wasm. I was hoping the JavaScript bridge might be slowing it down and that batching several .ts segments in 1 call might help.

    


    Command

    


    ffmpeg -i test.ts test.mp4


    


    Log

    


    [info] run FS.writeFile test.ts <349304 bytes binary file>
log.js:15 [info] run ffmpeg command: -i test.ts test.mp4
log.js:15 [fferr] ffmpeg version v0.9.0-2-gb11e5c1495 Copyright (c) 2000-2020 the FFmpeg developers
log.js:15 [fferr]   built with emcc (Emscripten gcc/clang-like replacement) 2.0.8 (d059fd603d0b45b584f634dc2365bc9e9a6ec1dd)
log.js:15 [fferr]   configuration: --target-os=none --arch=x86_32 --enable-cross-compile --disable-x86asm --disable-inline-asm --disable-stripping --disable-programs --disable-doc --disable-debug --disable-runtime-cpudetect --disable-autodetect --extra-cflags='-s USE_PTHREADS=1 -I/src/build/include -O3 --closure 1' --extra-cxxflags='-s USE_PTHREADS=1 -I/src/build/include -O3 --closure 1' --extra-ldflags='-s USE_PTHREADS=1 -I/src/build/include -O3 --closure 1 -L/src/build/lib' --pkg-config-flags=--static --nm=llvm-nm --ar=emar --ranlib=emranlib --cc=emcc --cxx=em++ --objcc=emcc --dep-cc=emcc --enable-gpl --enable-nonfree --enable-zlib --enable-libx264 --enable-libx265 --enable-libvpx --enable-libwavpack --enable-libmp3lame --enable-libfdk-aac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-libopus --enable-libwebp --enable-libass --enable-libfribidi
log.js:15 [fferr]   libavutil      56. 51.100 / 56. 51.100
log.js:15 [fferr]   libavcodec     58. 91.100 / 58. 91.100
log.js:15 [fferr]   libavformat    58. 45.100 / 58. 45.100
log.js:15 [fferr]   libavdevice    58. 10.100 / 58. 10.100
log.js:15 [fferr]   libavfilter     7. 85.100 /  7. 85.100
log.js:15 [fferr]   libswscale      5.  7.100 /  5.  7.100
log.js:15 [fferr]   libswresample   3.  7.100 /  3.  7.100
log.js:15 [fferr]   libpostproc    55.  7.100 / 55.  7.100
log.js:15 [fferr] Input #0, mpegts, from 'test.ts':
log.js:15 [fferr]   Duration: 00:00:04.00, start: 10.006000, bitrate: 698 kb/s
log.js:15 [fferr]   Program 1 
log.js:15 [fferr]     Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1280x720, 23.98 tbr, 90k tbn, 1411200000.00 tbc
log.js:15 [fferr]     Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 130 kb/s
log.js:15 [fferr] Stream mapping:
log.js:15 [fferr]   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
log.js:15 [fferr]   Stream #0:1 -> #0:1 (aac (native) -> aac (native))
log.js:15 [fferr] [libx264 @ 0x1f5f080] using cpu capabilities: none!
log.js:15 [fferr] [libx264 @ 0x1f5f080] profile High, level 3.1, 4:2:0, 8-bit
log.js:15 [fferr] [libx264 @ 0x1f5f080] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=23 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
log.js:15 [fferr] Output #0, mp4, to 'test.mp4':
log.js:15 [fferr]   Metadata:
log.js:15 [fferr]     encoder         : Lavf58.45.100
log.js:15 [fferr]     Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720, q=-1--1, 23.98 fps, 24k tbn, 23.98 tbc
log.js:15 [fferr]     Metadata:
log.js:15 [fferr]       encoder         : Lavc58.91.100 libx264
log.js:15 [fferr]     Side data:
log.js:15 [fferr]       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
log.js:15 [fferr]     Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
log.js:15 [fferr]     Metadata:
log.js:15 [fferr]       encoder         : Lavc58.91.100 aac
log.js:15 [fferr] frame=    3 fps=0.0 q=0.0 size=       0kB time=00:00:00.38 bitrate=   1.0kbits/s dup=1 drop=0 speed=0.521x    
log.js:15 [fferr] frame=   47 fps= 27 q=0.0 size=       0kB time=00:00:02.09 bitrate=   0.2kbits/s dup=1 drop=0 speed=1.22x    
log.js:15 [fferr] frame=   57 fps= 25 q=28.0 size=       0kB time=00:00:02.51 bitrate=   0.2kbits/s dup=1 drop=0 speed=1.13x    
log.js:15 [fferr] frame=   67 fps= 24 q=28.0 size=       0kB time=00:00:02.96 bitrate=   0.1kbits/s dup=1 drop=0 speed=1.08x    
log.js:15 [fferr] frame=   77 fps= 23 q=28.0 size=       0kB time=00:00:03.37 bitrate=   0.1kbits/s dup=1 drop=0 speed=1.03x    
log.js:15 [fferr] frame=   89 fps= 23 q=28.0 size=       0kB time=00:00:03.96 bitrate=   0.1kbits/s dup=1 drop=0 speed=1.04x    
log.js:15 [fferr] frame=   96 fps= 15 q=-1.0 Lsize=      60kB time=00:00:04.01 bitrate= 122.8kbits/s dup=1 drop=0 speed=0.646x    
log.js:15 [fferr] video:55kB audio:1kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 7.249582%
log.js:15 [fferr] [libx264 @ 0x1f5f080] frame I:1     Avg QP:17.20  size: 31521
log.js:15 [fferr] [libx264 @ 0x1f5f080] frame P:24    Avg QP:16.17  size:   735
log.js:15 [fferr] [libx264 @ 0x1f5f080] frame B:71    Avg QP:27.68  size:    91
log.js:15 [fferr] [libx264 @ 0x1f5f080] consecutive B-frames:  1.0%  0.0%  3.1% 95.8%
log.js:15 [fferr] [libx264 @ 0x1f5f080] mb I  I16..4: 26.2% 56.4% 17.4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] mb P  I16..4:  0.1%  0.2%  0.0%  P16..4:  3.5%  0.4%  0.2%  0.0%  0.0%    skip:95.4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  1.6%  0.0%  0.0%  direct: 0.0%  skip:98.3%  L0:31.0% L1:69.0% BI: 0.0%
log.js:15 [fferr] [libx264 @ 0x1f5f080] 8x8 transform intra:56.5% inter:59.4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] coded y,uvDC,uvAC intra: 17.4% 15.4% 7.5% inter: 0.2% 0.4% 0.0%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i16 v,h,dc,p: 29% 63%  1%  7%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 51% 31% 14%  0%  2%  1%  1%  0%  1%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 45% 11%  2%  3%  2%  4%  2%  4%
log.js:15 [fferr] [libx264 @ 0x1f5f080] i8c dc,h,v,p: 76% 17%  6%  1%
log.js:15 [fferr] [libx264 @ 0x1f5f080] Weighted P-Frames: Y:0.0% UV:0.0%
log.js:15 [fferr] [libx264 @ 0x1f5f080] ref P L0: 89.5%  1.6%  6.7%  2.3%
log.js:15 [fferr] [libx264 @ 0x1f5f080] ref B L0: 38.5% 60.9%  0.6%
log.js:15 [fferr] [libx264 @ 0x1f5f080] ref B L1: 97.7%  2.3%
log.js:15 [fferr] [libx264 @ 0x1f5f080] kb/s:111.08
log.js:15 [fferr] [aac @ 0x1f48100] Qavg: 65536.000
log.js:15 [ffout] FFMPEG_END
log.js:15 [info] run FS.readFile test.mp4
(index):38 Time elapsed: 6345 (This one's my own code.)
[info] run FS.readFile test.mp4


    


    (I'm running this on the browser. For the purposes of this question, consider the HTML player unavailable for use.)

    



    


    I also tested feeding the HLS live-stream URL as input to ffmpeg and outputting a single .mp4 file, but I couldn't play it until I ended the live-stream and ffmpeg finished downloading it.

    


    This one I ran on the (Windows) PC ; not the browser.

    


    Command

    


    ffmpeg -i https://stream.mux.com/lngMYGqNpHhYg2ZXqpH8WODVGzuenaZuhckdyunGpzU.m3u8 -acodec copy -bsf:a aac_adtstoasc -vcodec copy out.mp4


    


    Log

    


    The log is too large and StackOverflow won't let me paste it here, so I uploaded it to PasteBin : https://pastebin.com/FqvPQ1DZ