Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (87)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • MediaSPIP Init et Diogène : types de publications de MediaSPIP

    11 novembre 2010, par

    À l’installation d’un site MediaSPIP, le plugin MediaSPIP Init réalise certaines opérations dont la principale consiste à créer quatre rubriques principales dans le site et de créer cinq templates de formulaire pour Diogène.
    Ces quatre rubriques principales (aussi appelées secteurs) sont : Medias ; Sites ; Editos ; Actualités ;
    Pour chacune de ces rubriques est créé un template de formulaire spécifique éponyme. Pour la rubrique "Medias" un second template "catégorie" est créé permettant d’ajouter (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

Sur d’autres sites (7756)

  • The screen recorder utility has failed to store the actual screen recording iOS

    31 mai 2023, par manoj

    I am getting the below issue when I run my code to record the screen on failure.

    


    An unknown server-side error occurred while processing the command. Original error : The screen recorder utility has failed to store the actual screen recording at '/var/folders/js/h2_7h9bj1fj8cn19tqcm8hnw0000gn/T/202341-30610-87cfav.bsg2u/appium_3f7703.mp4'

    


    Note : This issue is occurring during the tearDown.

    


    the code is showing stop recording is failing and this issue is occurring for only one test class

    


    public static File screenRecording(String prefix) throws IOException {
        File classpathRoot = new File(System.getProperty("user.dir"));
        String screenRec = ((CanRecordScreen) driver).stopRecordingScreen();
        byte[] screenRecord = Base64.decodeBase64(screenRec);
        String destinationPath = classpathRoot.getAbsolutePath() + "/screenRecordings/" + driver.getPlatformName()
                + " Video " + prefix + " " + new Date() + ".mp4";
        Path filePath = Paths.get(destinationPath);
        Files.write(filePath, screenRecord);
        File recordedFile = FileUtils.getFile(String.valueOf(filePath));
        return recordedFile;
    }


    


    The same thing when I run it successfully is passing in other test

    


    This is the thread that I was reffering

    


    Appium stack

    


    [ INFO ] 2023-05-26 13:38:51.636 [TestHelpers.PropertiesHelper.getRestartDeviceProperty(PropertiesHelper.java:181)] - Loading the 'RestartDevice' Property from the 'appiumTests.properties' file
[ INFO ] 2023-05-26 13:38:51.641 [TestFixtures.BaseTestFixture.globalSetup(BaseTestFixture.java:81)] - Building Appium Server...
[ INFO ] 2023-05-26 13:38:51.733 [TestFixtures.BaseTestFixture.globalSetup(BaseTestFixture.java:88)] - Appium server is built.
[ INFO ] 2023-05-26 13:38:51.733 [TestFixtures.BaseTestFixture.globalSetup(BaseTestFixture.java:89)] - Starting appium server...
[Appium] Welcome to Appium v1.22.2
[Appium] Non-default server args:
[Appium]   port: 3022
[Appium]   logFile: /Users/subh/IdeaProjects/tile_mobile_automation/logs/appium.log
[Appium]   loglevel: info
[Appium]   relaxedSecurityEnabled: true
[Appium] Appium REST http interface listener started on 0.0.0.0:3022
[HTTP] --> GET /wd/hub/status
[HTTP] {}
[HTTP] <-- GET /wd/hub/status 200 5 ms - 68
[HTTP] 
[ INFO ] 2023-05-26 13:38:53.069 [TestFixtures.BaseTestFixture.globalSetup(BaseTestFixture.java:91)] - Appium server started.

[ffmpeg] Output #0, mp4, to '/var/folders/js/h2_7h9bj1fj8cn19tqcm8hnw0000gn/T/2023426-9341-y22m7g.0jfd/appium_eca508.mp4':
[ffmpeg]   Metadata:
[ffmpeg]     encoder         : Lavf59.27.100
[ffmpeg]   Stream #0:0: Video: h264 (avc1 / 0x31637661), yuvj420p(pc, bt470bg/unknown/unknown, progressive), 720x1280 [SAR 520:633 DAR 195:422], q=2-31, 25 fps, 12800 tbn
[ffmpeg]     Metadata:
[ffmpeg]       encoder         : Lavc59.37.100 libx264
[ffmpeg] 
[ffmpeg]     Side data:
[ffmpeg]       cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[ffmpeg] 
[XCUITest] Starting screen capture on the device 'xxxxxxxx-xxxxxxxxxxxxxxxx' with command: 'ffmpeg -f mjpeg -i http://127.0.0.1:9100 -vf scale=720:1280 -vcodec h264 -y /var/folders/js/h2_7h9bj1fj8cn19tqcm8hnw0000gn/T/2023426-9341-y22m7g.0jfd/appium_eca508.mp4'. Will timeout in 1800000ms
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/start_recording_screen 200 621 ms - 12
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/device/terminate_app
[HTTP] {"bundleId":"com.apple.Preferences"}
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/device/terminate_app 200 6 ms - 15
[HTTP] 
[ INFO ] 2023-05-26 13:39:15.082 [TestFixtures.BaseTestFixture.setUp(BaseTestFixture.java:200)] - App Version is 2.115.0(7936)
<-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element 200 208 ms - 137
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/CC010000-0000-0000-1709-000000000000/click
[HTTP] {"id":"CC010000-0000-0000-1709-000000000000"}
[W3C (9a4d93a9)] Driver proxy active, passing request on via HTTP proxy
[WD Proxy] Replacing sessionId 643ECEF8-D0E3-47D0-AE3D-3FC884C69235 with 9a4d93a9-b723-4e2e-abad-db859e5efeed
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/CC010000-0000-0000-1709-000000000000/click 200 805 ms - 65
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context
[HTTP] {}
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context 200 1 ms - 22
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element
[HTTP] {"using":"id","value":"OK"}
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element 200 309 ms - 137
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/39020000-0000-0000-1709-000000000000/displayed
[HTTP] {}
[W3C (9a4d93a9)] Driver proxy active, passing request on via HTTP proxy
[WD Proxy] Replacing sessionId 643ECEF8-D0E3-47D0-AE3D-3FC884C69235 with 9a4d93a9-b723-4e2e-abad-db859e5efeed
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/39020000-0000-0000-1709-000000000000/displayed 200 134 ms - 65
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context
[HTTP] {}
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context 200 1 ms - 22
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element
[HTTP] {"using":"id","value":"OK"}
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element 200 253 ms - 137
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/39020000-0000-0000-1709-000000000000/text
[HTTP] {}
[W3C (9a4d93a9)] Driver proxy active, passing request on via HTTP proxy
[WD Proxy] Replacing sessionId 643ECEF8-D0E3-47D0-AE3D-3FC884C69235 with 9a4d93a9-b723-4e2e-abad-db859e5efeed
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/39020000-0000-0000-1709-000000000000/text 200 117 ms - 65
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context
[HTTP] {}
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context 200 1 ms - 22
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element
[HTTP] {"using":"id","value":"OK"}
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element 200 247 ms - 137
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/39020000-0000-0000-1709-000000000000/click
[HTTP] {"id":"39020000-0000-0000-1709-000000000000"}
[W3C (9a4d93a9)] Driver proxy active, passing request on via HTTP proxy
[WD Proxy] Replacing sessionId 643ECEF8-D0E3-47D0-AE3D-3FC884C69235 with 9a4d93a9-b723-4e2e-abad-db859e5efeed
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/39020000-0000-0000-1709-000000000000/click 200 778 ms - 65
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context
[HTTP] {}
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/context 200 1 ms - 22
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element
[HTTP] {"using":"id","value":"btn_add_tile"}
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element 200 285 ms - 137
[HTTP] 
[HTTP] --> GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/06010000-0000-0000-1709-000000000000/displayed
[HTTP] {}
[W3C (9a4d93a9)] Driver proxy active, passing request on via HTTP proxy
[WD Proxy] Replacing sessionId 643ECEF8-D0E3-47D0-AE3D-3FC884C69235 with 9a4d93a9-b723-4e2e-abad-db859e5efeed
[HTTP] <-- GET /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/element/06010000-0000-0000-1709-000000000000/displayed 200 133 ms - 65
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/app/reset
[HTTP] {}
[DevCon Factory] Releasing connections for xxxxxxxx-xxxxxxxxxxxxxxxx device on 9100 port number
[DevCon Factory] No cached connections have been found
[DevCon Factory] Releasing connections for xxxxxxxx-xxxxxxxxxxxxxxxx device on any port number
[DevCon Factory] Found cached connections to release: ["00008110-0004150236E8401E:8100"]
[DevCon Factory] Releasing the listener for 'xxxxxxxx-xxxxxxxxxxxxxxxx:8100'
[BaseDriver] The following capabilities are not standard capabilities and should have an extension prefix:
[BaseDriver]   appPushTimeout
[BaseDriver]   app
[BaseDriver]   automationName
[BaseDriver]   deviceName
[BaseDriver]   fullReset
[BaseDriver]   newCommandTimeout
[BaseDriver]   noReset
[BaseDriver]   platformVersion
[BaseDriver]   processArguments
[BaseDriver]   showXcodeLog
[BaseDriver]   udid
[BaseDriver]   xcodeOrgId
[BaseDriver]   xcodeSigningId
[BaseDriver] Session created with session id: 7950b9ef-eac2-4169-a035-2d183deacf68
[XCUITest] Determining device to run tests on: udid: 'xxxxxxxx-xxxxxxxxxxxxxxxx', real device: true
[XCUITest] Normalized platformVersion capability value '16.4.1' to '16.4'
[BaseDriver] Using local app '/Users/subh/IdeaProjects/tile_mobile_automation/apps/tile_appstore_adhoc.ipa'
[BaseDriver] Will reuse previously cached application at '/var/folders/js/h2_7h9bj1fj8cn19tqcm8hnw0000gn/T/2023426-9341-af6qqi.jfr2v/tile.app'
[WebDriverAgent] Using WDA path: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent'
[WebDriverAgent] Using WDA agent: '/usr/local/lib/node_modules/appium/node_modules/appium-webdriveragent/WebDriverAgent.xcodeproj'
[XCUITest] Setting up real device
[XCUITest] App installation succeeded after 14402ms
[DevCon Factory] Requesting connection for device xxxxxxxx-xxxxxxxxxxxxxxxx on local port 8100, device port 8100
[DevCon Factory] Successfully requested the connection for xxxxxxxx-xxxxxxxxxxxxxxxx:8100
[WebDriverAgent] Will reuse previously cached WDA instance at 'http://127.0.0.1:8100/' with 'com.facebook.WebDriverAgentRunner'. Set the wdaLocalPort capability to a value different from 8100 if this is an undesired behavior.
[WebDriverAgent] Using provided WebdriverAgent at 'http://127.0.0.1:8100/'
[WD Proxy] Determined the downstream protocol as 'W3C'
[XCUITest] Skipping setting of the initial display orientation. Set the "orientation" capability to either "LANDSCAPE" or "PORTRAIT", if this is an undesired behavior.
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/app/reset 200 18735 ms - 14
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/device/terminate_app
[HTTP] {"bundleId":"com.apple.Preferences"}
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/device/terminate_app 200 1046 ms - 14
INFO: Loading the 'SaveVideoOnSuccess' Property from the 'appiumTests.properties' file
[HTTP] 
[HTTP] --> POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/stop_recording_screen
[HTTP] {}
[DevCon Factory] Releasing connections for xxxxxxxx-xxxxxxxxxxxxxxxx device on 9100 port number
[DevCon Factory] No cached connections have been found
[XCUITest] The screen recorder utility has failed to store the actual screen recording at '/var/folders/js/h2_7h9bj1fj8cn19tqcm8hnw0000gn/T/2023426-9341-y22m7g.0jfd/appium_eca508.mp4'
[DevCon Factory] Releasing connections for xxxxxxxx-xxxxxxxxxxxxxxxx device on 9100 port number
[DevCon Factory] No cached connections have been found
[HTTP] <-- POST /wd/hub/session/9a4d93a9-b723-4e2e-abad-db859e5efeed/appium/stop_recording_screen 500 14 ms - 841
[HTTP] 

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: The screen recorder utility has failed to store the actual screen recording at '/var/folders/js/h2_7h9bj1fj8cn19tqcm8hnw0000gn/T/2023426-9341-y22m7g.0jfd/appium_eca508.mp4'
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'localhost', ip: 'fe80:0:0:0:8c8:c2c0:abb2:3b1a%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '11.2', java.version: '11.0.11'
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities {app: /Users/subh/IdeaProjects/ti..., appPushTimeout: 50000, automationName: XCUITest, browserName: , databaseEnabled: false, deviceName: Tile DEV QA?s iPhone, fullReset: true, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: false, newCommandTimeout: 30, noReset: false, platform: MAC, platformName: ios, platformVersion: 16.4.1, processArguments: {arguments: -com.apple.CoreData.Concurr...}, showXcodeLog: true, takesScreenshot: true, udid: xxxxxxxx-xxxxxxxxxxxxxxxx, webStorageEnabled: false, xcodeOrgId: XK64B7G5HB, xcodeSigningId: iPhone Developer}
Session ID: 9a4d93a9-b723-4e2e-abad-db859e5efeed

  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
  at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
  at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
  at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
  at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
  at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
  at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
  at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:45)
  at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
  at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
  at io.appium.java_client.screenrecording.CanRecordScreen.stopRecordingScreen(CanRecordScreen.java:72)
  at TestFixtures.BaseTestFixture.tearDown(BaseTestFixture.java:253)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.base/java.lang.reflect.Method.invoke(Method.java:566)
  at org.testng.internal.invokers.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:135)
  at org.testng.internal.invokers.MethodInvocationHelper.invokeMethodConsideringTimeout(MethodInvocationHelper.java:65)
  at org.testng.internal.invokers.ConfigInvoker.invokeConfigurationMethod(ConfigInvoker.java:381)
  at org.testng.internal.invokers.ConfigInvoker.invokeConfigurations(ConfigInvoker.java:319)
  at org.testng.internal.invokers.TestInvoker.runConfigMethods(TestInvoker.java:803)
  at org.testng.internal.invokers.TestInvoker.runAfterConfigurations(TestInvoker.java:772)
  at org.testng.internal.invokers.TestInvoker.invokeMethod(TestInvoker.java:748)
  at org.testng.internal.invokers.TestInvoker.invokeTestMethod(TestInvoker.java:220)
  at org.testng.internal.invokers.MethodRunner.runInSequence(MethodRunner.java:50)
  at org.testng.internal.invokers.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:945)
  at org.testng.internal.invokers.TestInvoker.invokeTestMethods(TestInvoker.java:193)
  at org.testng.internal.invokers.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
  at org.testng.internal.invokers.TestMethodWorker.run(TestMethodWorker.java:128)
  at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
  at org.testng.TestRunner.privateRun(TestRunner.java:808)
  at org.testng.TestRunner.run(TestRunner.java:603)
  at org.testng.SuiteRunner.runTest(SuiteRunner.java:429)
  at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:423)
  at org.testng.SuiteRunner.privateRun(SuiteRunner.java:383)
  at org.testng.SuiteRunner.run(SuiteRunner.java:326)
  at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
  at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:95)
  at org.testng.TestNG.runSuitesSequentially(TestNG.java:1249)
  at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
  at org.testng.TestNG.runSuites(TestNG.java:1092)
  at org.testng.TestNG.run(TestNG.java:1060)
  at com.intellij.rt.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:66)
  at com.intellij.rt.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:109)




    


  • 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}`);
});


    


  • Xubuntu ffmpeg screen capturing very slow when no display connected

    8 décembre 2022, par fre_der

    I use ffmpeg on an Intel Nuc with Xubuntu 22.04 (XFCE4, lightdm), with x11grab for screen capturing the desktop, and sending output to a multicast UDP stream (which is shown on different IPTV sets in the network).
The system uses autologin, and autostarts Firefox in kiosk mode, rendering a html5 video.

    


    Everything works fine when a display is attached, but from the moment the hdmi cable is detached, the output video is extremely slow (very shaky, looks like 1 fps, audio is OK although it has occasional hickups).

    


    CPU and memory usage doesn't seem to be affected whether a display is attached or not.

    


    This runs fine on Xubuntu 18.04, although there might be small config changes that I'm not aware of.

    


    To be able to display output when no display is attached, I created a VIRTUAL1 display :

    


    xrandr -d :0 --verbose --newmode "1920x1080_60.00"  173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
xrandr -d :0 --verbose --addmode VIRTUAL1 "1920x1080_60.00"


    


    my /usr/share/X11/xorg.conf.d/20-intel.conf looks like :

    


    Section "Device"
  Identifier "Intel Graphics"
  Driver "intel"
  Option "VirtualHeads" "1"
  Option "TearFree" "true"
  Option "TripleBuffer" "true"
  Option "DRI" "false"
EndSection


    


    The ffmpeg command :

    


    ffmpeg -r 25 -thread_queue_size 512 -f x11grab -s 1920x1080 -i :0 -thread_queue_size 512 -f alsa -i default -c:a mp2 -f mpegts udp://239.255.255.8:50000?pkt_size=1316


    


    (during trial/error I tested various ffmpeg command line options to no avail)

    


    Output with hdmi cable attached :

    


    ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[x11grab @ 0x55f1fdfa18c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1670501458.257764, bitrate: 1658880 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 1658880 kb/s, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'default':
  Duration: N/A, start: 1670501459.560180, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg2video (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp2 (native))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'udp://239.255.255.8:50000?pkt_size=1316':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 1920x1080, q=2-31, 200 kb/s, 25 fps, 90k tbn
    Metadata:
      encoder         : Lavc58.134.100 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
    Metadata:
      encoder         : Lavc58.134.100 mp2
frame= 1041 fps= 25 q=31.0 Lsize=   12451kB time=00:00:41.56 bitrate=2454.3kbits/s speed=1.01x
video:9955kB audio:1920kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.847125%
Exiting normally, received signal 2.


    


    Output without hdmi cable attached :

    


    ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  WARNING: library configuration mismatch
  avcodec     configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --enable-version3 --disable-doc --disable-programs --enable-libaribb24 --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libtesseract --enable-libvo_amrwbenc --enable-libsmbclient
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
[x11grab @ 0x56325816a8c0] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':0':
  Duration: N/A, start: 1670501334.907900, bitrate: 1658880 kb/s
  Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 1658880 kb/s, 25 fps, 1000k tbr, 1000k tbn, 1000k tbc
Guessed Channel Layout for Input Stream #1.0 : stereo
Input #1, alsa, from 'default':
  Duration: N/A, start: 1670501336.193971, bitrate: 1536 kb/s
  Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg2video (native))
  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp2 (native))
Press [q] to stop, [?] for help
Output #0, mpegts, to 'udp://239.255.255.8:50000?pkt_size=1316':
  Metadata:
    encoder         : Lavf58.76.100
  Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, progressive), 1920x1080, q=2-31, 200 kb/s, 25 fps, 90k tbn
    Metadata:
      encoder         : Lavc58.134.100 mpeg2video
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: mp2, 48000 Hz, stereo, s16, 384 kb/s
    Metadata:
      encoder         : Lavc58.134.100 mp2
frame= 1020 fps= 26 q=31.0 Lsize=   11802kB time=00:00:40.72 bitrate=2374.3kbits/s speed=1.02x
video:9378kB audio:1873kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.892235%
Exiting normally, received signal 2.


    


    xrandr output with display connected (if no display connected then DP1 just says disconnected as the other outputs)

    


    Screen 0: minimum 8 x 8, current 1920 x 1080, maximum 32767 x 32767
DP1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 530mm x 300mm
   1920x1080     60.00*+  74.97    50.00    59.94
   1920x1080i    60.00    50.00    59.94
   1680x1050     59.88
   1280x1024     75.02    60.02
   1440x900      59.90
   1280x960      60.00
   1280x720      60.00    50.00    59.94
   1024x768      75.03    70.07    60.00
   832x624       74.55
   800x600       72.19    75.00    60.32    56.25
   720x576       50.00
   720x480       60.00    59.94
   640x480       75.00    72.81    66.67    60.00    59.94
   720x400       70.08
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
DP4 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
   1920x1080_60.00  59.96*
VIRTUAL2 disconnected (normal left inverted right x axis y axis)