Recherche avancée

Médias (91)

Autres articles (71)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • 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 (...)

Sur d’autres sites (9533)

  • Is there a way to program the (Download) button to save a group of images as a one video ?

    9 février 2024, par Lina Al-fawzan

    This is my entire code. Its function is that everything the user writes or says will have images returned to him according to what he wrote/said, and the next image will be shown to him after he presses “close,” and he can save each image separately. I want to make a simple modification to it. First, instead of a close button, I want each image to be displayed for 3 seconds and the next one to be displayed, and so on... “all of them in one window”, and for the “download” button to be when the last image is displayed, and for them all to be saved in one video.

    


    import &#x27;package:flutter/material.dart&#x27;;&#xA;import &#x27;package:flutter/services.dart&#x27; show rootBundle;&#xA;import &#x27;dart:convert&#x27;;&#xA;import &#x27;dart:typed_data&#x27;;&#xA;import &#x27;package:image_gallery_saver/image_gallery_saver.dart&#x27;;&#xA;import &#x27;package:speech_to_text/speech_to_text.dart&#x27; as stt;&#xA;&#xA;void main() {&#xA;  runApp(MyApp());&#xA;}&#xA;&#xA;class MyApp extends StatelessWidget {&#xA;  @override&#xA;  Widget build(BuildContext context) {&#xA;    return MaterialApp(&#xA;      home: MyHomePage(),&#xA;    );&#xA;  }&#xA;}&#xA;&#xA;class MyHomePage extends StatefulWidget {&#xA;  @override&#xA;  _MyHomePageState createState() => _MyHomePageState();&#xA;}&#xA;&#xA;class _MyHomePageState extends State<myhomepage> {&#xA;  TextEditingController _textEditingController = TextEditingController();&#xA;  late stt.SpeechToText _speech;&#xA;  bool _isListening = false;&#xA;&#xA;  @override&#xA;  void initState() {&#xA;    super.initState();&#xA;    _speech = stt.SpeechToText();&#xA;  }&#xA;&#xA;  void _listen() async {&#xA;    if (!_isListening) {&#xA;      bool available = await _speech.initialize(&#xA;        onStatus: (val) => print(&#x27;onStatus: $val&#x27;),&#xA;        onError: (val) => print(&#x27;onError: $val&#x27;),&#xA;      );&#xA;      if (available) {&#xA;        setState(() => _isListening = true);&#xA;        _speech.listen(&#xA;          onResult: (val) => setState(() {&#xA;            _textEditingController.text = val.recognizedWords;&#xA;            if (val.hasConfidenceRating &amp;&amp; val.confidence > 0) {&#xA;              _showImages(val.recognizedWords);&#xA;            }&#xA;          }),&#xA;        );&#xA;      }&#xA;    } else {&#xA;      setState(() => _isListening = false);&#xA;      _speech.stop();&#xA;    }&#xA;  }&#xA;&#xA;  @override&#xA;  Widget build(BuildContext context) {&#xA;    return Scaffold(&#xA;      appBar: AppBar(&#xA;        title: Text(&#x27;Image Viewer&#x27;),&#xA;      ),&#xA;      body: Padding(&#xA;        padding: const EdgeInsets.all(16.0),&#xA;        child: Column(&#xA;          mainAxisAlignment: MainAxisAlignment.center,&#xA;          children: [&#xA;            TextField(&#xA;              controller: _textEditingController,&#xA;              decoration: const InputDecoration(&#xA;                labelText: &#x27;Enter a word&#x27;,&#xA;              ),&#xA;            ),&#xA;            SizedBox(height: 16.0),&#xA;            ElevatedButton(&#xA;              onPressed: () {&#xA;                String userInput = _textEditingController.text;&#xA;                _showImages(userInput);&#xA;              },&#xA;              child: Text(&#x27;Show Images&#x27;),&#xA;            ),&#xA;            SizedBox(height: 16.0),&#xA;            ElevatedButton(&#xA;              onPressed: _listen,&#xA;              child: Text(_isListening ? &#x27;Stop Listening&#x27; : &#x27;Start Listening&#x27;),&#xA;            ),&#xA;          ],&#xA;        ),&#xA;      ),&#xA;    );&#xA;  }&#xA;&#xA;Future<void> _showImages(String userInput) async {&#xA;  String directoryPath = &#x27;assets/output_images/&#x27;;&#xA;  print("User Input: $userInput");&#xA;  print("Directory Path: $directoryPath");&#xA;&#xA;  List<string> assetFiles = await rootBundle&#xA;      .loadString(&#x27;AssetManifest.json&#x27;)&#xA;      .then((String manifestContent) {&#xA;    final Map manifestMap = json.decode(manifestContent);&#xA;    return manifestMap.keys&#xA;        .where((String key) => key.startsWith(directoryPath))&#xA;        .toList();&#xA;  });&#xA;&#xA;  List<string> imageFiles = assetFiles.where((String assetPath) =>&#xA;      assetPath.toLowerCase().endsWith(&#x27;.jpg&#x27;) ||&#xA;      assetPath.toLowerCase().endsWith(&#x27;.gif&#x27;)).toList();&#xA;&#xA;  List<string> words = userInput.split(&#x27; &#x27;); // Tokenize the sentence into words&#xA;&#xA;  for (String word in words) {&#xA;    String wordImagePath = &#x27;$directoryPath$word.gif&#x27;;&#xA;&#xA;    if (imageFiles.contains(wordImagePath)) {&#xA;      await _showDialogWithImage(wordImagePath);&#xA;    } else {&#xA;      for (int i = 0; i &lt; word.length; i&#x2B;&#x2B;) {&#xA;        String letter = word[i];&#xA;        String letterImagePath = imageFiles.firstWhere(&#xA;          (assetPath) => assetPath.toLowerCase().endsWith(&#x27;$letter.jpg&#x27;),&#xA;          orElse: () => &#x27;&#x27;,&#xA;        );&#xA;        if (letterImagePath.isNotEmpty) {&#xA;          await _showDialogWithImage(letterImagePath);&#xA;        } else {&#xA;          print(&#x27;No image found for $letter&#x27;);&#xA;        }&#xA;      }&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;  &#xA;&#xA;  Future<void> _showDialogWithImage(String imagePath) async {&#xA;    await showDialog<void>(&#xA;      context: context,&#xA;      builder: (BuildContext context) {&#xA;        return AlertDialog(&#xA;          content: Image.asset(imagePath),&#xA;          actions: [&#xA;            TextButton(&#xA;              onPressed: () {&#xA;                Navigator.of(context).pop();&#xA;              },&#xA;              child: Text(&#x27;Close&#x27;),&#xA;            ),&#xA;            TextButton(&#xA;              onPressed: () async {&#xA;                await _downloadImage(imagePath);&#xA;                Navigator.of(context).pop();&#xA;              },&#xA;              child: Text(&#x27;Download&#x27;),&#xA;            ),&#xA;          ],&#xA;        );&#xA;      },&#xA;    );&#xA;  }&#xA;&#xA;  Future<void> _downloadImage(String assetPath) async {&#xA;    try {&#xA;      final ByteData data = await rootBundle.load(assetPath);&#xA;      final List<int> bytes = data.buffer.asUint8List();&#xA;&#xA;      final result = await ImageGallerySaver.saveImage(Uint8List.fromList(bytes));&#xA;&#xA;      if (result != null) {&#xA;        ScaffoldMessenger.of(context).showSnackBar(&#xA;          SnackBar(&#xA;            content: Text(&#x27;Image saved to gallery.&#x27;),&#xA;          ),&#xA;        );&#xA;      } else {&#xA;        ScaffoldMessenger.of(context).showSnackBar(&#xA;          SnackBar(&#xA;            content: Text(&#x27;Failed to save image to gallery.&#x27;),&#xA;          ),&#xA;        );&#xA;      }&#xA;    } catch (e) {&#xA;      print(&#x27;Error downloading image: $e&#x27;);&#xA;    }&#xA;  }&#xA;}&#xA;&#xA;</int></void></void></void></string></string></string></void></myhomepage>

    &#xA;

  • OSError : [WinError 6] Checking Video Duration of Clips moviepy ffmpeg

    28 juin 2017, par Frikkie Maritz

    Any help will do
    my script used too run 100% without any problems but since yesterday keep getting this error

    Traceback (most recent call last):
     File "C:\Users\renushas\Desktop\videoCompuser Temp.py", line 19, in <module>
       video1 = VideoFileClip(clipspath)
     File "C:\Program Files\Python36\lib\site-packages\moviepy\video\io\VideoFileClip.py", line 81, in __init__
       fps_source=fps_source)
     File "C:\Program Files\Python36\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 32, in __init__
       fps_source)
     File "C:\Program Files\Python36\lib\site-packages\moviepy\video\io\ffmpeg_reader.py", line 256, in ffmpeg_parse_infos
       proc = sp.Popen(cmd, **popen_params)
     File "C:\Program Files\Python36\lib\subprocess.py", line 842, in __init__
       _cleanup()
     File "C:\Program Files\Python36\lib\subprocess.py", line 505, in _cleanup
       res = inst._internal_poll(_deadstate=sys.maxsize)
     File "C:\Program Files\Python36\lib\subprocess.py", line 1259, in _internal_poll
       if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
    OSError: [WinError 6] The handle is invalid
    </module>

    This is the code i am using

    import os
    from moviepy.editor import VideoFileClip

    path = 'C:/Renusha/'

    for folders in os.listdir(path):
       print(folders)
       if "." in folders:
           print("this is a file")
       else:
           infolders = path + folders + "/"
           print(infolders)
           for clips in os.listdir(infolders):
               print(clips)

               if ".mp4" in clips:

                   clipspath = infolders + "\\" + clips
                   video1 = VideoFileClip(clipspath)
                   print(video1.duration)
                   del video1.reader
                   del video1

    It reads and prints a lot of the clips duration and then randomly gives this error

  • Improve bash script for checking when ffmpeg hangs streaming IP cam rtsp to youtube

    15 octobre 2022, par shakespeare

    Background

    &#xA;&#xA;

    I have a garden IP cam id like to stream live to youtube, so i decided to use ffmpeg to achieve this.

    &#xA;&#xA;

    The problem

    &#xA;&#xA;

    Whenever my IP cam restarts or loses connection ; ffmpeg will get stuck on the same frame and not resume once the IP cam is back online.

    &#xA;&#xA;

    My solution

    &#xA;&#xA;

    I have the ffmpeg output logged to a file, then have a script fetch the last line of the log every few seconds and compares frame numbers. If the frame numbers match, it kills ffmpeg process and starts another ffmpeg process.

    &#xA;&#xA;

    My question

    &#xA;&#xA;

    Is there a better way more efficient way ?

    &#xA;&#xA;

    logchecker.sh

    &#xA;&#xA;

    #/bin/bash&#xA;while true&#xA;do&#xA;    frameA=$(tail /home/daniel/output.txt -n 1 | sed -nr &#x27;s/.*frame=(.*)fps.*/\1/p&#x27;)&#xA;    echo "$frameA"&#xA;    sleep 3&#xA;    frameB=$(tail /home/daniel/output.txt -n 1 | sed -nr &#x27;s/.*frame=(.*)fps.*/\1/p&#x27;)&#xA;    echo "$frameB"&#xA;&#xA;    if [ "$frameA" = "$frameB" ]&#xA;    then&#xA;        echo "Camera has hung"&#xA;        pkill ffmpeg&#xA;        echo "killed ffmpeg..."&#xA;        echo "Waiting 30 secs"&#xA;        sleep 30&#xA;        bash /home/daniel/ffmpeg.sh &amp;&#xA;        echo "started ffpmeg.."&#xA;        echo "Waiting 30 secs"&#xA;        sleep 30&#xA;    else &#xA;        echo "proceed"&#xA;    fi&#xA;&#xA;    sleep 2&#xA;done&#xA;

    &#xA;&#xA;

    ffmpeg.sh

    &#xA;&#xA;

    #!bin/bash&#xA;sleep 30&#xA;ffmpeg -f lavfi -i anullsrc -rtsp_transport udp -i rtsp://user:password@url:5544/live0.264 -bufsize 5000k -c:v copy -c:a mp3 -b:a 1 -f flv rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx 2> /home/daniel/output.txt&#xA;

    &#xA;