Recherche avancée

Médias (91)

Autres articles (65)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (9446)

  • Failed to find two consecutive MPEG audio frames [closed]

    3 décembre 2024, par matrixebiz

    I'm receiving this error trying to download/convert an m3u8

    


    [mp3 @ 000001c8f5112200] Format mp3 detected only with low score of 1, misdetection possible!
[mp3 @ 000001c8f5112200] Failed to find two consecutive MPEG audio frames.
[in#0 @ 000001c8f5111f40] Error opening input: Invalid data found when processing input


    


    Any way to fix this in my ffmpeg command line ? Also, playing the stream in VLC and other apps shows this in the path /%EF%BB%BF for some reason.
VLC is unable to open the MRL 'file :///C :/Temp/%EF%BB%BF'. Check the log for details. Then it will play the actual video.

    


    Do i need to change the beginning of the m3u8 ?
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1000,RESOLUTION=640x360,

    


    Even if I remove it and just leave the URL that is inside the m3u8, will still display the %EF%BB%BF which I need to stop from happening

    


    EDIT : Adding the PowerShell script I'm using to output my file :

    


    function Replace-FileText
{
    [CmdletBinding()]
    Param
    (
        $File1,
        $File2,
        $File1StartAnchor,
        $File1EndAnchor = "$",
        $File2StartAnchor,
        $File2EndAnchor = "$"
    )
    
    #Escape the regex meta characters, this assumes literals are used in the input
    $File1StartAnchorEscaped = [System.Text.RegularExpressions.Regex]::Escape($File1StartAnchor)
    $File2StartAnchorEscaped = [System.Text.RegularExpressions.Regex]::Escape($File2StartAnchor)

    if ($PSBoundParameters.ContainsKey('File1EndAnchor'))
    {
        $File1EndAnchorEscaped = [System.Text.RegularExpressions.Regex]::Escape($File1EndAnchor)
    }
    else
    {
        $File1EndAnchorEscaped = $File1EndAnchor
    }

    if ($PSBoundParameters.ContainsKey('File2EndAnchor'))
    {
        $File2EndAnchorEscaped = [System.Text.RegularExpressions.Regex]::Escape($File2EndAnchor)
    }
    else
    {
        $File2EndAnchorEscaped = $File2EndAnchor
    }


    if ((Get-Content $File1 -Raw) -match "$File1StartAnchorEscaped(.*?)$File1EndAnchorEscaped")
    {
        Write-Host "Found the following string in between the anchors in $File1 :$($Matches[1])"
        $TextToInject = $Matches[1]
    }
    else
    {
        Write-Host "Could not find the Start and end Anchors in $File1"
        return
    }
 
    if ((Get-Content $File2 -Raw) -match "$File2StartAnchorEscaped(.*?)$File2EndAnchorEscaped")
    {
        Write-Host "Found the following string in between the anchors in $File2 :$($Matches[1])"
        $TextToReplace = $Matches[1]
    }
    else
    {
        Write-Host "Could not find the Start Anchor in $File2"
        return
    }
 
    (Get-Content $File2 -Raw) -replace $TextToReplace,$TextToInject | Out-File $File2 -NoNewline
}
 
 
Replace-FileText -File1 'C:\EQDA\File1.txt' -File2 'C:\EQDA\File2.txt' -File1StartAnchor 'two' -File1EndAnchor '"' -File2StartAnchor 'four'
Replace-FileText -File1 'C:\EQDA\File1.txt' -File2 'C:\EQDA\File2.txt' -File1StartAnchor 'server-' -File1EndAnchor '-name' -File2StartAnchor 'server-' -File2EndAnchor '-name'


    


  • Unable to find correct bash syntax for comparing numbers

    17 octobre 2024, par kali

    Part of a long script I'm simply trying to compare two numbers, one is constant and the other one is retrieved via ffprobe (The 474 in the error messages is the height found by ffprobe)

    


    CURRENT_RES=$(ffprobe -v quiet -select_streams v:0 -show_entries stream=height -of csv=s=x:p=0 "${fn}")
  if [[ $CURRENT_RES -gt 1080 ]]; then
    echo "leaving preset normal"
    SLOW_PRESET=("" "")
  else
    echo "setting preset to slow"
    SLOW_PRESET=(-preset slow)
  fi;


    


    produces :

    


    /usr/local/bin/startScreen.sh: line 95: [[: 474

474: syntax error in expression (error token is "474")
setting preset to slow


    


    I also tried arithmetic operators like :

    


      if (($CURRENT_RES>1080)); then
    echo "leaving preset normal"
    SLOW_PRESET=("" "")
  else
    echo "setting preset to slow"
    SLOW_PRESET=(-preset slow)
  fi;


    


    got a slightly different, but essentially same error message like :

    


    /usr/local/bin/startScreen.sh: line 95: ((: 474

474>1080: syntax error in expression (error token is "474>1080")
setting preset to slow


    


    What's even more baffling is there 15 lines below this block there is another comparison which works perfectly fine !

    


    if [[ $CURRENT_RES -gt $CONVERT_HEIGHT ]]; then


    


    I thought may be the inline written 1080 number is confusing the if expression so I tried assigning 1080 to variable and reusing it, which changed nothing.

    


    edit : (dropping this here in case someone else falls into same mistake)
following up on Shawn's advice from comments using cat -v showed 474 was repeated twice.
For debugging purposes ran :

    


    ffprobe -v quiet -select_streams v:0 -show_entries stream=height -of json "filename.mp4"


    


    to find this weird format :

    


    {
    "programs": [
        {
            "streams": [
                {
                    "height": 472
                }
            ]
        }
    ],
    "streams": [
        {
            "height": 472
        }
    ]
}


    


    finally changed the ffprobe command to :

    


    CURRENT_RES=$(ffprobe -v quiet -select_streams v:0 -show_entries stream=height -of json "${fn}" | jq .streams[0].height)


    


    to resolve the issue.

    


  • python [WinError 2] the System Cannot Find the File Specified

    15 août 2024, par user26831166

    Code cant create a certain file
The thing is code isn't mine a took it from a friend and my friend get it from another person
and this 2 person can run code without any problem
but i have.

    


    import os
import random
import shutil
import subprocess

# Путь к папке с видео
video_folder = r'D:\bots\ttvidads\VID\Videorez'

# Путь к папке для сохранения результатов
output_folder = r'D:\bots\ttvidads\VID\ZAGOTOVKI\Videopod1'

# Очищаем содержимое конечной папки перед сохранением
for file in os.listdir(output_folder):
    file_path = os.path.join(output_folder, file)
    try:
        if os.path.isfile(file_path):
            os.unlink(file_path)
    except Exception as e:
        print(f"Failed to delete {file_path}. Reason: {e}")

# Получаем список видеофайлов
video_files = [os.path.join(video_folder, file) for file in os.listdir(video_folder) if file.endswith(('.mp4', '.avi'))]

# Выбираем случайное видео
random_video = random.choice(video_files)

# Получаем длительность видео в секундах
video_duration_command = f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{random_video}"'
video_duration_process = subprocess.Popen(video_duration_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
video_duration_output, _ = video_duration_process.communicate()
video_duration = float(video_duration_output)

# Выбираем случайное начальное время для вырезания
random_start = random.randrange(0, int(video_duration) - 19, 8)

# Получаем ширину и высоту исходного видео
video_info_command = f'ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "{random_video}"'
video_info_process = subprocess.Popen(video_info_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
video_info_output, _ = video_info_process.communicate()
video_width, video_height = map(int, video_info_output.strip().split(b'x'))

# Вычисляем новые координаты x1 и x2 для обрезки
max_x1 = video_width - int(video_height * 9 / 16)
random_x1 = random.randint(0, max_x1)
random_x2 = random_x1 + int(video_height * 9 / 16)

# Формируем команду для FFmpeg для выборки случайного отрезка видео с соотношением 9:16
ffmpeg_command = f'ffmpeg -hwaccel cuda -ss {random_start} -i "{random_video}" -t 19 -vf "crop={random_x2-random_x1}:{video_height}:{random_x1}:0" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k "{output_folder}\\temp.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_command, shell=True)

# Изменяем яркость, контрастность и размываем видео
brightness_factor = random.uniform(-0.18, -0.12)  # Случайный коэффициент яркости
contrast_factor = random.uniform(0.95, 1.05)  # Случайный коэффициент контрастности
blur_factor = random.uniform(4, 5)  # Случайный коэффициент размытия

# Формируем команду для FFmpeg для изменения яркости, контрастности и размытия видео
ffmpeg_modify_command = f'ffmpeg -hwaccel cuda -i "{output_folder}\\temp.mp4" -vf "eq=brightness={brightness_factor}:contrast={contrast_factor},boxblur={blur_factor}:{blur_factor}" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k "{output_folder}\\temp_modify.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_modify_command, shell=True)

# Растягиваем видео до нужного разрешения (1080x1920)
ffmpeg_stretch_command = f'ffmpeg -hwaccel cuda -i "{output_folder}\\temp_modify.mp4" -vf "scale=1080:1920" -c:v h264_nvenc -preset default -an -c:a aac -b:a 128k -r 30 "{output_folder}\\final_output.mp4"'

# Выполняем команду с помощью subprocess
subprocess.run(ffmpeg_stretch_command, shell=True)

# Удаляем временные файлы
os.remove(os.path.join(output_folder, 'temp.mp4'))
os.remove(os.path.join(output_folder, 'temp_modify.mp4'))

print("Видеофайл успешно обработан и сохранен.")


    


    Error i got after run the code

    


    = RESTART: D:\Bots\2vidpod.py&#xA;Traceback (most recent call last):&#xA;  File "D:\Bots\2vidpod.py", line 71, in <module>&#xA;    os.remove(os.path.join(output_folder, &#x27;temp.mp4&#x27;))&#xA;FileNotFoundError: [WinError 2] Не удается найти указанный файл: &#x27;D:\\bots\\ttvidads\\VID\\ZAGOTOVKI\\Videopod1\\temp.mp4&#x27;&#xA;</module>

    &#xA;

    so things i checked is&#xA;path is right&#xA;programs is installed FFMPEG and PYTHON all additional libraries downloaded&#xA;i pretty sure error caused by regular path and i wanna know if absolute path can do the thing

    &#xA;