Recherche avancée

Médias (1)

Mot : - Tags -/pirate bay

Autres articles (88)

  • 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 ;

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

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

Sur d’autres sites (11298)

  • avfilter/f_ebur128 : lift sample peak calculation out of main loop

    13 juin, par Niklas Haas
    avfilter/f_ebur128 : lift sample peak calculation out of main loop
    

    This is substantially faster ( 55%) than the transposed loop, and also
    avoids an unnecessary macro.

    • [DH] libavfilter/f_ebur128.c
  • How to embed additional metadata to a video file in libavcodec (FFmpeg C source code fork)

    7 mars 2023, par leavittx

    I'm extending an existing codec (Hap) inside ffmpeg library, adding some additional stuff to it (modifying FFmpeg code in my own fork of it)

    


    One of the things I'd like to do is to store a per-file maximum encoded packet size in some global header/metadata so I can use it later while doing decoding (generally, the metadata/info to store can be arbitrary, size is just what I currently need for some specialized decoder I'm writing).

    


    I'm modifying the ffmpeg code file
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/hapenc.c

    


    EDIT : What I'd like to achieve

    


      

    • Compute some numeric value during the encoding (namely, the maximum encoded frame size for the video - it's needed for a specialized fast decoder to not read all the frames beforehand) - that is done already
    • 


    • Store that value in the video file metadata (looks like it should be done on container level)
    • 


    


    My initial incorrect attempt :
But I don't currently see any possibility to save any info outside of a single packet being produced by hap_encode function and written to AVPacket *pkt parameter.

    


      

    1. Set dict parameter on AVCodecContext *avctx's priv_data :
    2. 


    


        av_opt_set_int(avctx->priv_data, "max_compressed_frame_size", <size>, 0);&#xA;    av_opt_set(avctx->priv_data, "max_compressed_frame_size", "", 0);&#xA;</size>

    &#xA;

    Later, while decoding av_opt_get/av_opt_get_int report non-existing key.

    &#xA;

      &#xA;
    1. Set various AVCodecContext *avctx fields :
    2. &#xA;

    &#xA;

        avctx->flags2 = <size>;&#xA;    avctx->extradata_size = <size>;&#xA;    avctx->ticks_per_frame = <size>;&#xA;    avctx->delay = <size>;&#xA;</size></size></size></size>

    &#xA;

    They all also seem to be not preserved when doing decoding later (I get just default values from decoder's AVCodecContext)

    &#xA;

  • Trying to get the current FPS and Frametime value into Matplotlib title

    16 juin 2022, par TiSoBr

    I try to turn an exported CSV with benchmark logs into an animated graph. Works so far, but I can't get the Titles on top of both plots with their current FPS and frametime in ms values animated.

    &#xA;

    Thats the output I'm getting. Looks like he simply stores all values in there instead of updating them ?

    &#xA;

    Screengrab of cli output&#xA;Screengrab of the final output (inverted)

    &#xA;

    from __future__ import division&#xA;import sys, getopt&#xA;import time&#xA;import matplotlib&#xA;import numpy as np&#xA;import subprocess&#xA;import math&#xA;import re&#xA;import argparse&#xA;import os&#xA;import glob&#xA;&#xA;import matplotlib.animation as animation&#xA;import matplotlib.pyplot as plt&#xA;&#xA;&#xA;def check_pos(arg):&#xA;    ivalue = int(arg)&#xA;    if ivalue &lt;= 0:&#xA;        raise argparse.ArgumentTypeError("%s Not a valid positive integer value" % arg)&#xA;    return True&#xA;    &#xA;def moving_average(x, w):&#xA;    return np.convolve(x, np.ones(w), &#x27;valid&#x27;) / w&#xA;    &#xA;&#xA;parser = argparse.ArgumentParser(&#xA;    description = "Example Usage python frame_scan.py -i mangohud -c &#x27;#fff&#x27; -o mymov",&#xA;    formatter_class=argparse.ArgumentDefaultsHelpFormatter)&#xA;parser.add_argument("-i", "--input", help = "Input data set from mangohud", required = True, nargs=&#x27;&#x2B;&#x27;, type=argparse.FileType(&#x27;r&#x27;), default=sys.stdin)&#xA;parser.add_argument("-o", "--output", help = "Output file name", required = True, type=str, default = "")&#xA;parser.add_argument("-r", "--framerate", help = "Set the desired framerate", required = False, type=float, default = 60)&#xA;parser.add_argument("-c", "--colors", help = "Colors for the line graphs; must be in quotes", required = True, type=str, nargs=&#x27;&#x2B;&#x27;, default = 60)&#xA;parser.add_argument("--fpslength", help = "Configures how long the data will be shown on the FPS graph", required = False, type=float, default = 5)&#xA;parser.add_argument("--fpsthickness", help = "Changes the line width for the FPS graph", required = False, type=float, default = 3)&#xA;parser.add_argument("--frametimelength", help = "Configures how long the data will be shown on the frametime graph", required = False, type=float, default = 2.5)&#xA;parser.add_argument("--frametimethickness", help = "Changes the line width for the frametime graph", required = False, type=float, default = 1.5)&#xA;parser.add_argument("--graphcolor", help = "Changes all of the line colors on the graph; expects hex value", required = False, default = &#x27;#FFF&#x27;)&#xA;parser.add_argument("--graphthicknes", help = "Changes the line width of the graph", required = False, type=float, default = 1)&#xA;parser.add_argument("-ts","--textsize", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 23)&#xA;parser.add_argument("-fsM","--fpsmax", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 180)&#xA;parser.add_argument("-fsm","--fpsmin", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 0)&#xA;parser.add_argument("-fss","--fpsstep", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 30)&#xA;parser.add_argument("-ftM","--frametimemax", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 50)&#xA;parser.add_argument("-ftm","--frametimemin", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 0)&#xA;parser.add_argument("-fts","--frametimestep", help = "Changes the the size of numbers marking the ticks", required = False, type=float, default = 10)&#xA;&#xA;arg = parser.parse_args()&#xA;status = False&#xA;&#xA;&#xA;if arg.input:&#xA;    status = True&#xA;if arg.output:&#xA;    status = True&#xA;if arg.framerate:&#xA;    status = check_pos(arg.framerate)&#xA;if arg.fpslength:&#xA;    status = check_pos(arg.fpslength)&#xA;if arg.fpsthickness:&#xA;    status = check_pos(arg.fpsthickness)&#xA;if arg.frametimelength:&#xA;    status = check_pos(arg.frametimelength)&#xA;if arg.frametimethickness:&#xA;    status = check_pos(arg.frametimethickness)&#xA;if arg.colors:&#xA;    if len(arg.output) != len(arg.colors):&#xA;        for i in arg.colors:&#xA;            if re.match(r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", i):&#xA;                status = True&#xA;            else:&#xA;                print(&#x27;{} : Isn\&#x27;t a valid hex value!&#x27;.format(i))&#xA;                status = False&#xA;    else:&#xA;        print(&#x27;You must have the same amount of colors as files in input!&#x27;)&#xA;        status = False&#xA;if arg.graphcolor:&#xA;    if re.match(r"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$", arg.graphcolor):&#xA;        status = True&#xA;    else:&#xA;        print(&#x27;{} : Isn\&#x27;t a vaild hex value!&#x27;.format(arg.graphcolor))&#xA;        status = False&#xA;if arg.graphthicknes:&#xA;    status = check_pos(arg.graphthicknes)&#xA;if arg.textsize:&#xA;    status = check_pos(arg.textsize)&#xA;if not status:&#xA;    print("For a list of arguments try -h or --help") &#xA;    exit()&#xA;&#xA;&#xA;# Empty output folder&#xA;files = glob.glob(&#x27;/output/*&#x27;)&#xA;for f in files:&#xA;    os.remove(f)&#xA;&#xA;&#xA;# We need to know the longest recording out of all inputs so we know when to stop the video&#xA;longest_data = 0&#xA;&#xA;# Format the raw data into a list of tuples (fps, frame time in ms, time from start in micro seconds)&#xA;# The first three lines of our data are setup so we ignore them&#xA;data_formated = []&#xA;for li, i in enumerate(arg.input):&#xA;    t = 0&#xA;    sublist = []&#xA;    for line in i.readlines()[3:]:&#xA;        x = line[:-1].split(&#x27;,&#x27;)&#xA;        fps = float(x[0])&#xA;        frametime = int(x[1])/1000 # convert from microseconds to milliseconds&#xA;        elapsed = int(x[11])/1000 # convert from nanosecond to microseconds&#xA;        data = (fps, frametime, elapsed)&#xA;        sublist.append(data)&#xA;    # Compare last entry of each list with the &#xA;    if sublist[-1][2] >= longest_data:&#xA;        longest_data = sublist[-1][2]&#xA;    data_formated.append(sublist)&#xA;&#xA;&#xA;max_blocksize = max(arg.fpslength, arg.frametimelength) * arg.framerate&#xA;blockSize = arg.framerate * arg.fpslength&#xA;&#xA;&#xA;# Get step time in microseconds&#xA;step = (1/arg.framerate) * 1000000 # 1000000 is one second in microseconds&#xA;frame_size_fps = (arg.fpslength * arg.framerate) * step&#xA;frame_size_frametime = (arg.frametimelength * arg.framerate) * step&#xA;&#xA;&#xA;# Total frames will have to be updated for more then one source&#xA;total_frames = int(int(longest_data) / step)&#xA;&#xA;&#xA;if True: # Gonna be honest, this only exists so I can collapse this block of code&#xA;&#xA;    # Sets up our figures to be next to each other (horizontally) and with a ratio 3:1 to each other&#xA;    fig, (ax1, ax2) = plt.subplots(1, 2, gridspec_kw={&#x27;width_ratios&#x27;: [3, 1]})&#xA;&#xA;    # Size of whole output 1920x360 1080/3=360&#xA;    fig.set_size_inches(19.20, 3.6)&#xA;&#xA;    # Make the background transparent&#xA;    fig.patch.set_alpha(0)&#xA;&#xA;&#xA;    # Loop through all active axes; saves a lot of lines in ax1.do_thing(x) ax2.do_thing(x)&#xA;    for axes in fig.axes:&#xA;&#xA;        # Set all splines to the same color and width&#xA;        for loc, spine in axes.spines.items():&#xA;            axes.spines[loc].set_color(arg.graphcolor)&#xA;            axes.spines[loc].set_linewidth(arg.graphthicknes)&#xA;&#xA;        # Make sure we don&#x27;t render any data points as this will be our background&#xA;        axes.set_xlim(-(max_blocksize * step), 0)&#xA;        &#xA;&#xA;        # Make both plots transparent as well as the background&#xA;        axes.patch.set_alpha(.5)&#xA;        axes.patch.set_color(&#x27;#020202&#x27;)&#xA;&#xA;        # Change the Y axis info to be on the right side&#xA;        axes.yaxis.set_label_position("right")&#xA;        axes.yaxis.tick_right()&#xA;&#xA;        # Add the white lines across the graphs; the location of the lines are based off set_{}ticks&#xA;        axes.grid(alpha=.8, b=True, which=&#x27;both&#x27;, axis=&#x27;y&#x27;, color=arg.graphcolor, linewidth=arg.graphthicknes)&#xA;&#xA;        # Remove X axis info&#xA;        axes.set_xticks([])&#xA;&#xA;    # Add a another Y axis so ticks are on both sides&#xA;    tmp_ax1 = ax1.secondary_yaxis("left")&#xA;    tmp_ax2 = ax2.secondary_yaxis("left")&#xA;&#xA;    # Set both to the same values&#xA;    ax1.set_yticks(np.arange(arg.fpsmin, arg.fpsmax &#x2B; 1, step=arg.fpsstep))&#xA;    ax2.set_yticks(np.arange(arg.frametimemin, arg.frametimemax &#x2B; 1, step=arg.frametimestep))&#xA;    tmp_ax1.set_yticks(np.arange(arg.fpsmin , arg.fpsmax &#x2B; 1, step=arg.fpsstep))&#xA;    tmp_ax2.set_yticks(np.arange(arg.frametimemin, arg.frametimemax &#x2B; 1, step=arg.frametimestep))&#xA;&#xA;    # Change the "ticks" to be white and correct size also change font size&#xA;    ax1.tick_params(axis=&#x27;y&#x27;, color=arg.graphcolor ,width=arg.graphthicknes, length=16, labelsize=arg.textsize, labelcolor=arg.graphcolor)&#xA;    ax2.tick_params(axis=&#x27;y&#x27;, color=arg.graphcolor ,width=arg.graphthicknes, length=16, labelsize=arg.textsize, labelcolor=arg.graphcolor)&#xA;    tmp_ax1.tick_params(axis=&#x27;y&#x27;, color=arg.graphcolor ,width=arg.graphthicknes, length=8, labelsize=0) # Label size of 0 disables the fps/frame numbers&#xA;    tmp_ax2.tick_params(axis=&#x27;y&#x27;, color=arg.graphcolor ,width=arg.graphthicknes, length=8, labelsize=0)&#xA;&#xA;&#xA;    # Limits Y scale&#xA;    ax1.set_ylim(arg.fpsmin,arg.fpsmax &#x2B; 1)&#xA;    ax2.set_ylim(arg.frametimemin,arg.frametimemax &#x2B; 1)&#xA;&#xA;    # Add an empty plot&#xA;    line = ax1.plot([], lw=arg.fpsthickness)&#xA;    line2 = ax2.plot([], lw=arg.frametimethickness)&#xA;&#xA;    # Sets all the data for our benchmark&#xA;    for benchmarks, color in zip(data_formated, arg.colors):&#xA;        y = moving_average([x[0] for x in benchmarks], 25)&#xA;        y2 = [x[1] for x in benchmarks]&#xA;        x = [x[2] for x in benchmarks]&#xA;        line &#x2B;= ax1.plot(x[12:-12],y, c=color, lw=arg.fpsthickness)&#xA;        line2 &#x2B;= ax2.step(x,y2, c=color, lw=arg.fpsthickness)&#xA;    &#xA;    # Add titles with values&#xA;    ax1.set_title("Avg. frames per second: {}".format(y2), color=arg.graphcolor, fontsize=20, fontweight=&#x27;bold&#x27;, loc=&#x27;left&#x27;)&#xA;    ax2.set_title("Frametime in ms: {}".format(y2), color=arg.graphcolor, fontsize=20, fontweight=&#x27;bold&#x27;, loc=&#x27;left&#x27;)  &#xA;&#xA;    # Removes unwanted white space; also controls the space between the two graphs&#xA;    plt.tight_layout(pad=0, h_pad=0, w_pad=2.5)&#xA;    &#xA;    fig.canvas.draw()&#xA;&#xA;    # Cache the background&#xA;    axbackground = fig.canvas.copy_from_bbox(ax1.bbox)&#xA;    ax2background = fig.canvas.copy_from_bbox(ax2.bbox)&#xA;&#xA;&#xA;# Create a ffmpeg instance as a subprocess we will pipe the finished frame into ffmpeg&#xA;# encoded in Apple QuickTime (qtrle) for small(ish) file size and alpha support&#xA;# There are free and opensource types that will also do this but with much larger sizes&#xA;canvas_width, canvas_height = fig.canvas.get_width_height()&#xA;outf = &#x27;{}.mov&#x27;.format(arg.output)&#xA;cmdstring = (&#x27;ffmpeg&#x27;,&#xA;                &#x27;-stats&#x27;, &#x27;-hide_banner&#x27;, &#x27;-loglevel&#x27;, &#x27;error&#x27;, # Makes ffmpeg less annoying / to much console output&#xA;                &#x27;-y&#x27;, &#x27;-r&#x27;, &#x27;60&#x27;, # set the fps of the video&#xA;                &#x27;-s&#x27;, &#x27;%dx%d&#x27; % (canvas_width, canvas_height), # size of image string&#xA;                &#x27;-pix_fmt&#x27;, &#x27;argb&#x27;, # format cant be changed since this is what  `fig.canvas.tostring_argb()` outputs&#xA;                &#x27;-f&#x27;, &#x27;rawvideo&#x27;,  &#x27;-i&#x27;, &#x27;-&#x27;, # tell ffmpeg to expect raw video from the pipe&#xA;                &#x27;-vcodec&#x27;, &#x27;qtrle&#x27;, outf) # output encoding must support alpha channel&#xA;pipe = subprocess.Popen(cmdstring, stdin=subprocess.PIPE)&#xA;&#xA;def render_frame(frame : int):&#xA;&#xA;    # Set the bounds of the graph for each frame to render the correct data&#xA;    start = (frame * step) - frame_size_fps&#xA;    end = start &#x2B; frame_size_fps&#xA;    ax1.set_xlim(start,end)&#xA;     &#xA;     &#xA;    start = (frame * step) - frame_size_frametime&#xA;    end = start &#x2B; frame_size_frametime&#xA;    ax2.set_xlim(start,end)&#xA;    &#xA;&#xA;    # Restore background&#xA;    fig.canvas.restore_region(axbackground)&#xA;    fig.canvas.restore_region(ax2background)&#xA;&#xA;    # Redraw just the points will only draw points with in `axes.set_xlim`&#xA;    for i in line:&#xA;        ax1.draw_artist(i)&#xA;        &#xA;    for i in line2:&#xA;        ax2.draw_artist(i)&#xA;&#xA;    # Fill in the axes rectangle&#xA;    fig.canvas.blit(ax1.bbox)&#xA;    fig.canvas.blit(ax2.bbox)&#xA;    &#xA;    fig.canvas.flush_events()&#xA;&#xA;    # Converts the finished frame to ARGB&#xA;    string = fig.canvas.tostring_argb()&#xA;    return string&#xA;&#xA;&#xA;&#xA;&#xA;#import multiprocessing&#xA;#p = multiprocessing.Pool()&#xA;#for i, _ in enumerate(p.imap(render_frame, range(0, int(total_frames &#x2B; max_blocksize))), 20):&#xA;#    pipe.stdin.write(_)&#xA;#    sys.stderr.write(&#x27;\rdone {0:%}&#x27;.format(i/(total_frames &#x2B; max_blocksize)))&#xA;#p.close()&#xA;&#xA;#Signle Threaded not much slower then multi-threading&#xA;if __name__ == "__main__":&#xA;    for i , _ in enumerate(range(0, int(total_frames &#x2B; max_blocksize))):&#xA;        render_frame(_)&#xA;        pipe.stdin.write(render_frame(_))&#xA;        sys.stderr.write(&#x27;\rdone {0:%}&#x27;.format(i/(total_frames &#x2B; max_blocksize)))&#xA;

    &#xA;