Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (73)

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

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (7522)

  • problem in making HLS using ffmpeg problem

    24 juin 2023, par AMZ

    I have a function do run in background and create m3u8 for some videos : (I is running in background and updating some fields in django).

    


    def convert_to_hls(episode):
    # Set the output directory for HLS files
output_dir = os.path.join(settings.MEDIA_ROOT, 'hls')
os.makedirs(output_dir, exist_ok=True)

# Set the input video file path
input_file_path = episode.videoFile.path

# Set the output filename and path for the HLS playlist
# filename = os.path.splitext(os.path.basename(input_file_path))[0]
characters = string.ascii_letters + string.digits
filename = ''.join(random.choice(characters) for _ in range(45))
playlist_path = os.path.join(output_dir, f'{filename}.m3u8')

# Set the output path for the HLS segments
segments_path = os.path.join(output_dir, f'{filename}_%05d.ts')

# Construct the ffmpeg command for HLS conversion
command = [
    'ffmpeg',
    '-i', input_file_path,
    '-c:v', 'libx264',
    '-crf', '23',
    '-preset', 'medium',
    '-c:a', 'aac',
    '-b:a', '128k',
    '-f', 'hls',
    '-hls_time', '10',
    '-hls_list_size', '0',
    '-hls_segment_filename', segments_path,
    playlist_path
]
# Execute the ffmpeg command
subprocess.run(command, check=True)

episode.hls_created = True
episode.hls_url = playlist_path.replace("/home/debian/project","")
episode.save()

return True


    


    this code works well for most of my videos but for some .mp4 files gets :

    


    [Fri Jun 23 17:05:47.511095 2023] [wsgi:error] [pid 19975:tid 140289048565504] Exception in thread Thread-1:
[Fri Jun 23 17:05:47.511198 2023] [wsgi:error] [pid 19975:tid 140289048565504] Traceback (most recent call last):
[Fri Jun 23 17:05:47.511244 2023] [wsgi:error] [pid 19975:tid 140289048565504]   File "/opt/bitnami/python/lib/python3.8/threading.py", line 932, in _bootstrap_inner
[Fri Jun 23 17:05:47.512078 2023] [wsgi:error] [pid 19975:tid 140289048565504]     self.run()
[Fri Jun 23 17:05:47.512124 2023] [wsgi:error] [pid 19975:tid 140289048565504]   File "/opt/bitnami/python/lib/python3.8/threading.py", line 870, in run
[Fri Jun 23 17:05:47.512707 2023] [wsgi:error] [pid 19975:tid 140289048565504]     self._target(*self._args, **self._kwargs)
[Fri Jun 23 17:05:47.512748 2023] [wsgi:error] [pid 19975:tid 140289048565504]   File "/home/debian/project/twapp/views/episode_backgrounds.py", line 41, in convert_to_hls
[Fri Jun 23 17:05:47.512950 2023] [wsgi:error] [pid 19975:tid 140289048565504]     subprocess.run(command, check=True)
[Fri Jun 23 17:05:47.512989 2023] [wsgi:error] [pid 19975:tid 140289048565504]   File "/opt/bitnami/python/lib/python3.8/subprocess.py", line 516, in run
[Fri Jun 23 17:05:47.513500 2023] [wsgi:error] [pid 19975:tid 140289048565504]     raise CalledProcessError(retcode, process.args,
[Fri Jun 23 17:05:47.513657 2023] [wsgi:error] [pid 19975:tid 140289048565504] subprocess.CalledProcessError: Command '['ffmpeg', '-i', '/home/debian/project/media/videos/introduction_to_raster_qBhrnAx.mp4', '-c:v', 'libx264', '-crf', '23', '-preset', 'medium', '-c:a', 'aac', '-b:a', '128k', '-f', 'hls', '-hls_time', '10', '-hls_list_size', '0', '-hls_segment_filename', '/home/debian/project/media/hls/ZN3fsJVEfTDEc8MFb5DrP7Y34JFNLj0hfWnGRZAwFdjuG_%05d.ts', '/home/debian/project/media/hls/ZN3fsJVEfTDEc8MFb5DrP7Y34JFNLj0hfWnGRZAwFdjuG.m3u8']' returned non-zero exit status 1.


    


    Also it does not work for .MOV files.

    


  • Converting and Splitting .wav into .m4a with ffmpeg produces clicks between the splitted files

    24 mai 2023, par calp

    I need to convert an audio .wav-file to .m4a and splitting this m4a into small pieces of four seconds using ffmpeg. These files will be played in a webside again as one continous piece of audio.

    


    The problem is that I get clicks every four seconds where I have a transition from one file to the next.

    


    I found out that ffmpeg does not split the files correctly. I tried two different ways :

    


      

    1. First splitting the wave file and then converting the single files to m4a
    2. 


    3. First converting the wave file to m4a and then splitting it.
    4. 


    


    (1) does not work at all : ffmpeg cuts randomly into the audio and the next piece starts with a fade in. On the first picture you see the splitted wave-file on the first track, converted m4a on the second.

    


    First track: splitted wav, second track: afterwards converted m4a

    


    (2) works better, as the audio is not cut randomly. But the new file still starts with a fade in.

    


    First track: converted m4a, second track: afterward splitted

    


    On the pictures you see a 400Hz sinus for testing purpose.

    


    For converting I used

    


    ffmpeg -i file.wav -c:a aac -b:a 64k out.m4a

    


    For splitting I used :

    


    ffmpeg -i file.m4a -f segment -segment_time 4 -c copy out%03d.m4a

    


    Of course with changing the file extensions according to the order of steps.

    


    Has anyone an idea, how I can avoid these fade-ins and / or split the files correctly ?

    


  • How to convert n numbers of images into a video slideshow with putting some transition on each images with flutter_ffmpeg ?

    26 avril 2023, par Shruti Ramnandan Sharma

    I'm trying to convert images into a video slideshow with some transition. I have used flutter_ffmpeg plugin , with this plugin I have created with only 3 images but I want to add n numbers of images but couldn't able to find solutions for it. I tried to add more images but it throws error.

    


    I'm gonna add some piece of code below :

    


      

    1. Instance of FlutterFFmpeg
    2. 


    


      final FlutterFFmpeg _flutterFFmpeg = FlutterFFmpeg(); 


    


      

    1. Picking multiple images from the gallery and applying command to convert images into a video
    2. 


    


    void mergeImageVideo() async {
    final ImagePicker picker = ImagePicker();
    final images = await picker.pickMultiImage();

    var im1 = images[0].path;

    var im2 = images[1].path;

    var im3 = images[2].path;

   //-shortest
    openLoadingDialog(context, "Creating video");
    generateFilePath("ImageVideoMerge").then((outputFile) {
      var backgroundColor = 'FFF44336';

      String ffmpegCommand = VideoUtil.generateImagesToVideoScript(
          im1, im2, im3, outputFile, 'mpeg4', '', backgroundColor);

      print("ffmpegCommand==> $ffmpegCommand");
      _flutterFFmpeg.execute(ffmpegCommand).then((v) {
        if (v == 0) {
          var file = File(outputFile);
          Navigator.pop(context);
          showSnackBar(context, "Images Added Successfully", Colors.black);
          updateVideoPlayer(file);
        } else {
          Navigator.pop(context);
        }
      }).then((executionId) {
      });
    });
  }



    


    method to get ffmpeg command (images into video with scale transition)

    


    static String generateImagesToVideoScript(
      String image1Path,
      String image2Path,
      String image3Path,
      String videoFilePath,
      String videoCodec,
      String customOptions,
      String backgroundColor
      ) {

    // ignore: prefer_interpolation_to_compose_strings
     return "-hide_banner -y -loop 1 -i '" +
        image1Path +
        "' " +
        "-loop   1 -i \"" +
        image2Path +
        "\" " +
        "-loop 1   -i \"" +
        image3Path +
        "\" " +
        "-filter_complex " +
        "\" " +
        "[0:v]setpts=PTS-STARTPTS,scale=w=640:h=424,setsar=sar=1/1,split=2[stream1out1][stream1out2];" +
        "[1:v]setpts=PTS-STARTPTS,scale=w=640:h=424,setsar=sar=1/1,split=2[stream2out1][stream2out2];" +
        "[2:v]setpts=PTS-STARTPTS,scale=w=640:h=424,setsar=sar=1/1,split=2[stream3out1][stream3out2];" +
        "[stream1out1]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#$backgroundColor,trim=duration=3,select=lte(n\\,90)[stream1overlaid];" +
        "[stream1out2]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#$backgroundColor,trim=duration=1,select=lte(n\\,30)[stream1ending];" +
        "[stream2out1]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#$backgroundColor,trim=duration=2,select=lte(n\\,60)[stream2overlaid];" +
        "[stream2out2]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#$backgroundColor,trim=duration=1,select=lte(n\\,30),split=2[stream2starting][stream2ending];" +
        "[stream3out1]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#$backgroundColor,trim=duration=2,select=lte(n\\,60)[stream3overlaid];" +
        "[stream3out2]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#$backgroundColor,trim=duration=1,select=lte(n\\,30)[stream3starting];" +
        "[stream2starting][stream1ending]blend=all_expr='if(gte(X,(W/2)*T/1)*lte(X,W-(W/2)*T/1),B,A)':shortest=1[stream2blended];" +
        "[stream3starting][stream2ending]blend=all_expr='if(gte(X,(W/2)*T/1)*lte(X,W-(W/2)*T/1),B,A)':shortest=1[stream3blended];" +
        "[stream1overlaid][stream2blended][stream2overlaid][stream3blended][stream3overlaid]concat=n=5:v=1:a=0,scale=w=640:h=424,format=yuv420p[video]\"" +
        " -map [video] -vsync 2 -async 1 " +
        customOptions +
        "-c:v " +
        videoCodec +
        " -r 30 " +
        videoFilePath;
  }