Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (57)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • 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

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

Sur d’autres sites (7046)

  • Taking in RTSP stream, converting it to fragmented mp4 using ffmpeg before broadcasting to connected clients through web socket

    24 mars 2023, par Shaun

    I am taking in a live RTSP stream and converting it to fragmented mp4 using ffmpeg before re-distributing it to connected clients via a websocket. The clients will then play it using a normal web browser such as Chrome with Media Source Extensions. Most of the time, the code will work as intended but there will be occasions when the process of parsing the chunks emitted from the ffmpeg stdout will run into some issues. When everything is working well, each chunk of data emitted from ffmpeg will be parsed, sliced and regrouped into either a Initialisation Segment (made up of a FYTP box and a MOOV box) OR a Media Segment (made up of a MOOF box and a MDAT box). The key steps involved are :

    


      

    1. Every byte of data coming out from will first be pushed into an array.
    2. 


    3. Next, I will try to locate the box headers ('FYTP', 'MOOV', 'MOOF', 'MDAT') in the data.
    4. 


    5. After the box headers are located, I will look for the length of each corresponding box (which resides in the first 32 bytes of each box) to locate the start and end of each box.
    6. 


    7. With the box's length, I will then parse the array to filter out the data.
    8. 


    9. Once the entire segment is filtered out, I will send it to all connected clients. For 'FYTP and 'MOOV', they will only be sent once to each client. For 'MOOF' AND 'MDAT', this will be a continuous process for as long as the client(s) are connected.
    10. 


    


    However, when things are not working well, my code will for some unknown reason be unable to slice the segments correctly. During the debugging process, I will notice that the problem will start first with a segment having sliced a few extra bytes more than it should have at the end. This problem will then quickly escalate and the next few segments will go totally haywire.

    


    My suspicion is that this problem has less to do with my code than from the ffmpeg output. Has anyone faced similar problem before ? The following is my code. Any help on this will be much appreciated ! Thank you.

    


    const WebSocket = require("ws");
const { spawn } = require('child_process');
const rtspUrl = "rtsp://localhost:8554/mystream";
const fs = require('fs');
const outputFile = fs.createWriteStream('ffmpeg_output.bin');
const wss = new WebSocket.Server({ port: 4001 });

var buf_chunks_string_holder_array = [];
var initialization_segment_ready_flag = false;
var initialization_segment_to_send = [];
var buffered_media_segment_ready_flag = false;
var buffered_media_segment_to_send = [];
var segment_end_index = { "box_type": "nil", "end_index": 0 };
var next_segment_counter = 0;
var processing_counter_queue = []
var moof_counter = 0;
var mdat_counter = 0;
var checker = '';

wss.on("connection", (ws) => {
    console.log("Client connected");
  if (initialization_segment_ready_flag == true) {
    wss.clients.forEach(client => {
      client.send(new Uint8Array(initialization_segment_to_send).buffer);
    })
  }
  if (buffered_media_segment_ready_flag == true) {
    wss.clients.forEach(client => {
      client.send(new Uint8Array(buffered_media_segment_to_send.buffer));
    })
  }

  ws.on("close", () => {
    console.log("Client disconnected");
  });

  ws.addEventListener("error", (error) => {
    console.error("WebSocket error:", error);
  });

});

const ffmpeg = spawn("ffmpeg", [
  "-rtsp_transport",
  "tcp",
  "-i",
  rtspUrl,
  "-g",
  "10",
  "-bufsize", 
  "50k",
  "-preset",
  "ultrafast",
  "-tune",
  "zerolatency",
  "-c:v",
  "libx264",
  "-c:a",
  "aac",
  '-f',
  'mp4',
  '-movflags',
  'frag_keyframe+empty_moov+default_base_moof',
  '-min_frag_duration',
  '50000',   
  "pipe:1",
]);

function decToHex(dec) {
  return dec.toString(16).padStart(2,'0').toUpperCase();
}

function hexToDec(hex) {
  return parseInt(hex, 16);
}

//This is where the parsing and calculating of the length of each box will take place.
ffmpeg.stdout.on('data', (chunk) => {
  outputFile.write(chunk);
  for (var i=0; i < chunk.length; i ++){
    buf_chunks_string_holder_array.push(chunk[i]);
    checker += decToHex(chunk[i]);
    if(checker.length == 16){
      if (checker.slice(-8) === '66747970'){
        let box_size_string = checker.slice(-16, -8);
        let num_bytes = hexToDec(box_size_string);
        next_segment_counter += num_bytes;
      }
      else if(checker.slice(-8) === '6D6F6F76'){
        let box_size_string = checker.slice(-16, -8);
        let num_bytes = hexToDec(box_size_string);
        next_segment_counter += num_bytes;
        segment_end_index = { "box_type": "ftyp&moov", "end_index": next_segment_counter };
        processing_counter_queue.push(segment_end_index);
        next_segment_counter = 0;
      }
      else if(checker.slice(-8) === '6D6F6F66'){
        let box_size_string = checker.slice(-16, -8);
        let num_bytes = hexToDec(box_size_string);
        next_segment_counter += num_bytes;
        moof_counter ++;      
      }
      else if(checker.slice(-8) === '6D646174'){
        let box_size_string = checker.slice(-16, -8);
        let num_bytes = hexToDec(box_size_string);
        next_segment_counter += num_bytes;
        segment_end_index = { "box_type": "moof&mdat", "end_index": next_segment_counter };
        processing_counter_queue.push(segment_end_index);
        next_segment_counter = 0;
        mdat_counter ++;  
      }
      checker = checker.slice(2);
    }
  }
    //This is where the data will be sliced, grouped into their respective segments and sent to the connected clients.
  if (processing_counter_queue.length > 0) {
    var jobs_removal_counter = 0;
    processing_counter_queue.forEach(job_info => {
      if (job_info.box_type == 'ftyp&moov' && buf_chunks_string_holder_array.length >= job_info.end_index) {
        initialization_segment_to_send = buf_chunks_string_holder_array.slice(0, job_info.end_index);
        initialization_segment_ready_flag = true;
        buf_chunks_string_holder_array = buf_chunks_string_holder_array.slice(job_info.end_index);
        jobs_removal_counter++;
      }
      if (job_info.box_type == 'moof&mdat' && buf_chunks_string_holder_array.length >= job_info.end_index) {
        buffered_media_segment_to_send = buf_chunks_string_holder_array.slice(0, job_info.end_index);
        buffered_media_segment_ready_flag = true;
        buf_chunks_string_holder_array = buf_chunks_string_holder_array.slice(job_info.end_index);
        if (buf_chunks_string_holder_array.length!= 0 ||
          (buf_chunks_string_holder_array[4]!= 102 && buf_chunks_string_holder_array[5]!= 116 && buf_chunks_string_holder_array[6]!= 121 && buf_chunks_string_holder_array[7]!= 112) || 
          (buf_chunks_string_holder_array[4]!= 109 && buf_chunks_string_holder_array[5]!= 100 && buf_chunks_string_holder_array[6]!= 97 && buf_chunks_string_holder_array[7]!= 116)){
          buf_chunks_string_holder_array = [];
          processing_counter_queue = [];
        }
        jobs_removal_counter++;
        if (wss.clients.size >= 1) {
          wss.clients.forEach(client => {
            client.send(new Uint8Array(buffered_media_segment_to_send).buffer);
          })
        }
      } 
      processing_counter_queue = processing_counter_queue.slice(jobs_removal_counter);
    }
    );
  }
});

ffmpeg.stderr.on('data', (data) => {
  console.log(`stderr: ${data}`);
});

ffmpeg.on('close', (code) => {
  console.log(`FFmpeg process exited with code ${code}`);
});


    


  • 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

    


  • Decrypting fragmented mpeg-dash using ffmpeg

    6 octobre 2022, par Sayem Prodhan Ananta

    I have an mpeg-dash which I want to decrypt. I have the CENC decryption key. But I am unable to get it working. The dash uses segment template. Here is the dash

    


    &lt;?xml version="1.0" ?>&#xA;<mpd mediapresentationduration="PT1H55M53.987S" minbuffertime="PT6.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011">&#xA;  &#xA;  <period>&#xA;    &#xA;    <adaptationset maxheight="720" maxwidth="1280" mimetype="video/mp4" segmentalignment="true" startwithsap="1">&#xA;      <accessibility schemeiduri="urn:scte:dash:cc:cea-608:2015" value="eng"></accessibility>&#xA;      <viewpoint schemeiduri="urn:mpeg:dash:role:2011" value="vp2"></viewpoint>&#xA;      &#xA;      <contentprotection schemeiduri="urn:mpeg:dash:mp4protection:2011" value="cenc"></contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">&#xA;        pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA&#x2B;ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA&#x2B;ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA&#x2B;AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA&#x2B;ADwALwBXAFIATQBIAEUAQQBEAEUAUgA&#x2B;AA==&#xA;      </contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">&#xA;        AAAAQ3Bzc2gAAAAA7e&#x2B;LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==&#xA;      </contentprotection>&#xA;      <segmenttemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startnumber="1" timescale="1000"></segmenttemplate>&#xA;      <representation bandwidth="634478" codecs="avc1.4D401F" framerate="2997/100" height="288" scantype="progressive" width="512"></representation>&#xA;      <representation bandwidth="789637" codecs="avc1.4D401F" framerate="2997/100" height="360" scantype="progressive" width="640"></representation>&#xA;      <representation bandwidth="1562569" codecs="avc1.4D401F" framerate="2997/100" height="432" scantype="progressive" width="768"></representation>&#xA;      <representation bandwidth="2124583" codecs="avc1.4D401F" framerate="2997/100" height="720" scantype="progressive" width="1280"></representation>&#xA;    </adaptationset>&#xA;    &#xA;    <adaptationset lang="en" mimetype="audio/mp4" segmentalignment="true" startwithsap="1">&#xA;      &#xA;      <contentprotection schemeiduri="urn:mpeg:dash:mp4protection:2011" value="cenc"></contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">&#xA;        pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA&#x2B;ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA&#x2B;ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA&#x2B;AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA&#x2B;ADwALwBXAFIATQBIAEUAQQBEAEUAUgA&#x2B;AA==&#xA;      </contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">&#xA;        AAAAQ3Bzc2gAAAAA7e&#x2B;LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==&#xA;      </contentprotection>&#xA;      <segmenttemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startnumber="1" timescale="1000"></segmenttemplate>&#xA;      <representation audiosamplingrate="48000" bandwidth="136225" codecs="mp4a.40.2">&#xA;        <audiochannelconfiguration schemeiduri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></audiochannelconfiguration>&#xA;      </representation>&#xA;    </adaptationset>&#xA;  </period>&#xA;</mpd>&#xA;

    &#xA;

    I have produced an mp4 file by combining all the segments like this

    &#xA;

    init.mp4&#x2B;seg-1.m4s&#x2B;seg-2.m4s&#x2B;....&#x2B;seg-1159.m4s&#xA;

    &#xA;

    But I end up with following error

    &#xA;

    ffmpeg version N-99631-g9018257751-anan5a-2020-10-19 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --extra-version=anan5a-2020-10-19 --enable-gpl --enable-version3 --disable-shared --enable-static --enable-small --enable-avisynth --enable-chromaprint --enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-openal --enable-opencl --enable-opengl --enable-libdrm --enable-nonfree --enable-libfdk-aac --enable-libbluray --enable-libzimg --enable-libsvtav1&#xA;  libavutil      56. 60.100 / 56. 60.100&#xA;  libavcodec     58.111.101 / 58.111.101&#xA;  libavformat    58. 62.100 / 58. 62.100&#xA;  libavdevice    58. 11.102 / 58. 11.102&#xA;  libavfilter     7. 87.100 /  7. 87.100&#xA;  libswscale      5.  8.100 /  5.  8.100&#xA;  libswresample   3.  8.100 /  3.  8.100&#xA;  libpostproc    55.  8.100 / 55.  8.100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Incorrect number of samples in encryption info&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s): unspecified pixel format&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; (0) and &#x27;probesize&#x27; (5000000) options&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;../videos/enc.0a7bd4e9ec72b6e0-5549.mkv&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41iso5iso6&#xA;  Duration: 01:55:47.95, bitrate: 625 kb/s&#xA;    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 11988 tbr, 11988 tbn, 23976 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Bento4 Video Handler&#xA;    Side data:&#xA;      unknown side data type 24 (779 bytes)&#xA;Output #0, matroska, to &#x27;../videos/dec.0a7bd4e9ec72b6e0-5549.mkv&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41iso5iso6&#xA;    encoder         : Lavf58.62.100&#xA;    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 616 kb/s, 29.97 fps, 11988 tbr, 1k tbn, 11988 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Bento4 Video Handler&#xA;    Side data:&#xA;      unknown side data type 24 (779 bytes)&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (copy)&#xA;Press [q] to stop, [?] for help&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Incorrect number of samples in encryption info&#xA;../videos/enc.0a7bd4e9ec72b6e0-5549.mkv: Invalid data found when processing input&#xA;frame=    0 fps=0.0 q=-1.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    &#xA;video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;

    &#xA;

    How can I achieve the decryption without error ??

    &#xA;