Recherche avancée

Médias (1)

Mot : - Tags -/iphone

Autres articles (83)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

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

    5 septembre 2013, par

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

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (8856)

  • Latency in ffmpeg while live streaming

    22 janvier 2014, par mustafa.yavuz

    I am working on a project which has real time jobs. I should process a live stream with almost no latency. As you know when we play a live stream with ffplay there is some latency since it buffers some frames before playing it. Is there same problem with ffmpeg, that is when I connect a live stream and do some process like resampling and other calculations, does it have latency as ffplay has. How can I be sure there is no latency ?

  • Cron job using database results

    9 mars 2013, par Fibericon

    I need help in creating a cron job script. Basically, I want to grab the next scheduled item and run it through ffmpeg to stream. This would be the mysql query (I'm using PHP variables to indicate what should go there - I don't actually know how variables work in cron jobs) :

    SELECT show.file FROM show, schedule
    WHERE channel = 1 AND start_time <= $current_time;

    This would be the ffmpeg command :

    ffmpeg -re -i $file http://127.0.0.1:8090/feed.ffm

    How would I create a cron job to execute these commands ?

  • How to Match ASS Subtitle Font Size with Flutter Text Size for a 1080p Video ?

    16 décembre 2024, par Mostafa Fathi

    I’m working on a project where I need to synchronize the font size of ASS subtitles with the text size a user sees in a Flutter application. The goal is to ensure that the text size in a 1080p video matches what the user sees in the app.

    


    What I've Tried :

    


      

    1. Calculating font size using height ratio (PlayResY/DeviceHeight) :
    2. 


    


      

    • I used the formula :
    • 


    


    FontSize_ASS = FontSize_Flutter * (PlayResY / DeviceHeight)


    


      

    • While the result seemed logical, the final output in the video was smaller than expected.
    • 


    


      

    1. Adding a scaling factor :
    2. 


    


      

    • I introduced a scaling factor (around 3.0) to address the size discrepancy.
    • 


    • This improved the result but still felt inconsistent and lacked precision.
    • 


    


      

    1. Using force_style in FFmpeg :
    2. 


    


      

    • I applied the force_style parameter to control the font size in FFmpeg directly.
    • 


    


    ffmpeg -i input.mp4 -vf "subtitles=subtitle.ass:force_style='FontSize=90'" -c:a copy output.mp4


    


      

    • While it produced better results, it’s not an ideal solution as it bypasses the calculations in the ASS file.
    • 


    


      

    1. Aligning PlayResX and PlayResY in the ASS file :
I ensured that these parameters matched the target video resolution (1920×1080) :
    2. 


    


    PlayResX: 1920
PlayResY: 1080


    


      

    • Despite this adjustment, the font size didn’t align perfectly with the Flutter app text size.
    • 


    


      

    1. Reading font metrics from the font file dynamically :
To improve precision, I wrote a function in Flutter that reads font metrics (units per EM, ascender, and descender) from the TTF font file and calculates a more accurate scaling factor :
    2. 


    


    Future readFontMetrics(
      String fontFilePath, 
      double originalFontSize,
) async {
  final fontData = await File(fontFilePath).readAsBytes();
  final fontBytes = fontData.buffer.asUint8List();
  final byteData = ByteData.sublistView(fontBytes);

  int numTables = readUInt16BE(byteData, 4);
  int offsetTableStart = 12;
  Map> tables = {};

  for (int i = 0; i < numTables; i++) {
    int recordOffset = offsetTableStart + i * 16;
    String tag =
        utf8.decode(fontBytes.sublist(recordOffset, recordOffset          + 4));
    int offset = readUInt32BE(byteData, recordOffset + 8);
    int length = readUInt32BE(byteData, recordOffset + 12);

    tables[tag] = {
      'offset': offset,
      'length': length,
    };
  }

  if (!tables.containsKey('head') || !tables.containsKey('hhea'){
    print('Required tables not found in the font file.');
    return null;
  }

  int headOffset = tables['head']!['offset']!;
  int unitsPerEm = readUInt16BE(byteData, headOffset + 18);

  int hheaOffset = tables['hhea']!['offset']!;
  int ascender = readInt16BE(byteData, hheaOffset + 4);
  int descender = readInt16BE(byteData, hheaOffset + 6);

  print('unitsPerEm: $unitsPerEm');
  print('ascender: $ascender');
  print('descender: $descender');

  int nominalSize = unitsPerEm;
  int realDimensionSize = ascender - descender;
  double scaleFactor = realDimensionSize / nominalSize;
  double realFontSize = originalFontSize * scaleFactor;

  print('Scale Factor: $scaleFactor');
  print('Real Font Size: $realFontSize');

  return realFontSize;
}


    


      

    • This function dynamically reads the font properties (ascender, descender, and unitsPerEM) and calculates a scale factor to get the real font size. Despite this effort, discrepancies persist when mapping it to the ASS font size.
    • 


    


    Question :
How can I ensure that the font size in the ASS file accurately reflects the size the user sees in Flutter ? Is there a reliable method to calculate or align the sizes correctly across both systems ? Any insights or suggestions would be greatly appreciated.

    


    Thank you ! 🙏