Recherche avancée

Médias (91)

Autres articles (111)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

  • 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

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (11360)

  • MoviePy and FFMPEG "No attribute" errors

    22 mars 2023, par CypherTretii

    I am trying to create a python script that will produce the type of cartoon TikToks with the satisfying video on the bottom part. I am still getting a bunch of errors like "ffmpeg has no attribute "metadata", or some other atribute that is missing"

    


    import os
import random
import hashlib
from moviepy.editor import *

# Function to get MD5 hash of a file
def get_md5_hash(file_path):
    with open(file_path, "rb") as f:
        bytes = f.read()
        hash = hashlib.md5(bytes)
        return hash.hexdigest()

# Input video file path
input_file_path = "C:/Users/Kris/output_movies/Bojack.Horseman.S01E01.720p.WEBRip.x264-W4F_1.mp4"

# Re-render the video
video = VideoFileClip(input_file_path)
video.write_videofile("re_rendered_video.mp4", codec='libx264')

# Change MD5 hash
new_md5_hash = get_md5_hash("re_rendered_video.mp4")
os.rename("re_rendered_video.mp4", f"{new_md5_hash}.mp4")

# Clear ID3 tag metadata
video = VideoFileClip(f"{new_md5_hash}.mp4")
video.reader.metadata.clear()
video.reader.close()

# Choose random video from folder and combine with input video
random_video_path = random.choice(os.listdir("C:/Users/Kris/satisfying_vids"))
random_video = VideoFileClip(f"C:/Users/Kris/satisfying_vids/{random_video_path}")

# Ensure the bottom video is at least as long as the input video
while random_video.duration < video.duration:
    if random_video.duration * 2 <= video.duration:
        random_video = concatenate_videoclips([random_video, random_video])
    else:
        duration_diff = video.duration - random_video.duration
        looped_video = random_video.subclip(0, duration_diff)
        random_video = concatenate_videoclips([random_video, looped_video])

# If the concatenated video exceeds the length of the input video, trim it
if random_video.duration > video.duration:
    random_video = random_video.subclip(0, video.duration)

# Resize the bottom video to match the input video resolution
random_video_resized = random_video.resize((960, 540))

# Combine the videos in 1:1 aspect ratio with the bottom video at the bottom of the screen
final_video = clips_array([[video], [random_video_resized]])

# Save the final video with .mp4 format
final_video.write_videofile(f"{new_md5_hash}_combined.mp4", codec='libx264')


# Increase brightness and contrast
final_video = VideoFileClip(f"{new_md5_hash}_combined.mp4")
final_video = final_video.fx(vfx.colorx, 0, [random.uniform(-0.2, 0.2), random.uniform(-1, 1)])
final_video.write_videofile(f"{new_md5_hash}_processed.mp4", codec='libx264')

# Color one pixel black and crop one pixel from bottom right corner
final_video = VideoFileClip(f"{new_md5_hash}_processed.mp4")
final_video = final_video.fx(vfx.painting, paint_color=[0,0,0], width=1, height=1, x=0, y=0)
final_video = final_video.crop(x1=0, y1=0, x2=final_video.w-1, y2=final_video.h-1)
final_video.write_videofile(f"{new_md5_hash}_final.mp4", codec='libx264')



    


    the goal for the code is :

    


    Takes an .mp4 file as input (the file is 1920 x 1080 in terms of resolution)

    


    Re-renders the video

    


    Changes the MD5 Hash

    


    Clears ID3 Tag Metadata

    


    Choses another random video from a folder, that is 1920 x 1080 pixels in terms of resolution - combine the chosen video with the input video in 1:1 aspect ratio. Put the video that is randomly chosen from the folder on bottom side of the screen.

    


    Increase the video’s brightness by random number ranging from -0.2 to 0.2

    


    Increase contrast by random number ranging from -1 to 1

    


    Color one pixel black

    


    Crop 1 pixel from the down right angle

    


    Save the final video with .mp4 format

    


    This is the error I am getting when running my code :
AttributeError : 'FFMPEG_VideoReader' object has no attribute 'metadata'

    


    Along with various missing attributes.

    


  • Best logical formula to determine perceptual / "experienced" quality of a video, given resolution / fps and bitrate ?

    20 mars 2023, par JamesK

    I am looking for a formula that can provide me with a relatively decent approximation of a Video's playback quality that can be calculated based off of four metrics : width, height, fps, and bitrate (bits/sec). Alternatively, I can also use FFMPEG or similar tools to calculate a Video's playback quality, if any of those tools provide something like what I am looking for here.

    


    An example of what a Video might look like in my problem is as follows :

    


    interface Video {
  /** The width of the Video (in pixels). */
  width: number
  /** The height of the Video (in pixels). */
  height: number
  /** The frame rate of the Video (frames per second). */
  fps: number
  /** The bitrate of the video, in bits per second (e.g. 5_000_000 = 5Mbit/sec) */
  bitrate: number
}


    


    I came up with the following function to compute the average amount of bits available for any given pixel per second :

    


    const computeVideoQualityScalar = (video: Video): number => {
  // The amount of pixels pushed to the display, per frame.
  const pixelsPerFrame = video.width * video.height
  
  // The amount of pixels pushed to the display, per second.
  const pixelsPerSecond = pixelsPerFrame * video.fps
  
  // The average amount of bits used by each pixel, each second,
  // to convey all data relevant to that pixel (e.g. color data, etc)
  const bitsPerPixelPerSecond = video.bitrate / pixelsPerSecond
  
  return bitsPerPixelPerSecond
}


    


    While my formula does do a good job of providing a more-or-less "standardized" assessment of mathematical quality for any given video, it falls short when I try to use it to compare videos of different resolutions to one another. For example, a 1080p60fps video with a bitrate of 10Mbit/sec has a greater visual fidelity (at least, subjectively speaking, to my eyes) than a 720p30fps video with a bitrate of 9Mbit/sec, but my formula would score the 720p30fps video significantly higher than the 1080p60fps video because the 720p video has more bits available per pixel per second than the 1080p video.

    


    I am struggling to come up with ideas as to how to either come up with a different way to calculate the "subjective video quality" for a given video, or extend upon my existing idea here.

    


  • About "ffmpeg -c copy" two ts files, can not play the problem

    4 septembre 2022, par Orlando Bloom

    aaa.mp4

    


    General
Complete name                            : C:/aaa.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 3.08 MiB
Duration                                 : 11 s 512 ms
Overall bit rate                         : 2 248 kb/s
Writing application                      : Lavf57.83.100
Comment                                  : GIFSHOW [899819595][iOS][11.4.1][iPhone9,2][5.8.5.606][Camera:f]#[720x1280][5327k][78k][C][1][tv=bec1_f80c][ags=0.455141][agm=0.747282][agsi=2000]

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 11 s 512 ms
Bit rate                                 : 2 161 kb/s
Width                                    : 720 pixels
Height                                   : 1 280 pixels
Display aspect ratio                     : 0.563
Frame rate mode                          : Constant
Frame rate                               : 29.970 (29970/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.078
Stream size                              : 2.96 MiB (96%)
Writing library                          : x264 core 148
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC SBR
Format/Info                              : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name                          : HE-AAC
Format settings                          : Explicit
Codec ID                                 : mp4a-40-2
Duration                                 : 11 s 501 ms
Bit rate mode                            : Constant
Bit rate                                 : 78.8 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 21.533 FPS (2048 SPF)
Compression mode                         : Lossy
Stream size                              : 111 KiB (4%)
Default                                  : Yes
Alternate group                          : 1




    


    I want to merge this mp4 with another ts file, because my hardware configuration is very poor, so I choose "-c copy"

    


    General
ID                                       : 1 (0x1)
Complete name                            : C:/bbb.ts
Format                                   : MPEG-TS
File size                                : 3.41 MiB
Duration                                 : 15 s 315 ms
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 861 kb/s

Video
ID                                       : 256 (0x100)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : 27
Duration                                 : 15 s 382 ms
Width                                    : 1 080 pixels
Height                                   : 606 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive

Audio
ID                                       : 257 (0x101)
Menu ID                                  : 1 (0x1)
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Format version                           : Version 4
Muxing mode                              : ADTS
Codec ID                                 : 15-2
Duration                                 : 15 s 185 ms
Bit rate mode                            : Variable
Channel(s)                               : 1 channel
Channel layout                           : C
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -46 ms





    


    I directly -c copy them, can't play the whole thing,

    


    Then I convert aaa.mp4 to ts
using "ffmpeg -i aaa.mp4 -bsf:v h264_mp4toannexb -codec copy -hls_list_size 0 aaa.ts" , this is what I googled.

    


    Finally tried aaa.ts and bbb.ts with "-c copy", still can't play.

    


    My machine configuration is acceptable, convert aaa.mp4 to the same encoding as bbb.ts

    


    If I transcode both together, I can't do it because bbb.ts is too big.