Recherche avancée

Médias (91)

Autres articles (61)

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

  • Soumettre améliorations et plugins supplémentaires

    10 avril 2011

    Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
    Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

Sur d’autres sites (5243)

  • Complie FFMpeg with Xcode5 preview's clang

    2 août 2013, par Yeung

    With release of IOS7 beta, I would like to try compiling ffmpeg for ios7.

    There is a lots answer like this. It use the llvm-gcc as compiler.

    However, seem like Xcode 5 would not include llvm-gcc. Then I have no choice but to use clang to compile.

    I use the following to config :

    export IOS_SDK="/Applications/Xcode5-DP4.app/Contents/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk"

    ./configure $CONFIG_DISABLE_FLAG $CONFIG_ENABLE_FLAG \
    --arch=arm \
    --target-os=darwin \
    --cc=/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang \
    --as='gas-preprocessor.pl /Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang' \
    --ar=/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar  \
    --sysroot=$IOS_SDK \
    --cpu=cortex-a8 \
    --extra-cflags="-arch armv7 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot ${IOS_SDK} -I${IOS_SDK}/usr/include" \
    --extra-ldflags="-arch armv7 -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot ${IOS_SDK} -L${IOS_SDK}/usr/lib" \
    --enable-pic

    clang would probably not take CFLAGS other than -arch  -isysroot -I into account, but let it be.

    I seems it can complie but I encounter this. Actually, I don't understand the answer in this question. Using the external assembler ? Yes, the toolchains do have a assembler stated it is GNU version 1.38. Using --as=/Application/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as, it even cannot pass the check as test. It fall back to use 'gas-preprocessor.pl $CC'

    Here is the config log to cannot pass :

       check_asm armv6t2 "movt r0, #0"
    check_as
    BEGIN /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
       1   void foo(void){ __asm__ volatile("movt r0, #0"); }
    END /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    /Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as --sysroot=/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -arch armv7 -no-cpp-precomp -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot /Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -mcpu=cortex-a8 -fPIC -c -o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.g896h4Sb.o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    FATAL:/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/arm/as: I don't understand '-' flag!
    check_asm armvfp "fadds s0, s0, s0"
    check_as
    BEGIN /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
       1   void foo(void){ __asm__ volatile("fadds s0, s0, s0"); }
    END /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    /Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as --sysroot=/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -arch armv7 -no-cpp-precomp -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot /Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -mcpu=cortex-a8 -fPIC -c -o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.g896h4Sb.o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    FATAL:/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/arm/as: I don't understand '-' flag!
    check_asm neon "vadd.i16 q0, q0, q0"
    check_as
    BEGIN /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
       1   void foo(void){ __asm__ volatile("vadd.i16 q0, q0, q0"); }
    END /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    /Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as --sysroot=/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -arch armv7 -no-cpp-precomp -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot /Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -mcpu=cortex-a8 -fPIC -c -o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.g896h4Sb.o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    FATAL:/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/arm/as: I don't understand '-' flag!
    check_asm vfpv3 "vmov.f32 s0, #1.0"
    check_as
    BEGIN /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
       1   void foo(void){ __asm__ volatile("vmov.f32 s0, #1.0"); }
    END /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    /Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as --sysroot=/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -arch armv7 -no-cpp-precomp -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot /Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -mcpu=cortex-a8 -fPIC -c -o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.g896h4Sb.o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    FATAL:/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/arm/as: I don't understand '-' flag!
    check_asm asm_mod_y "vmul.i32 d0, d0, %y0" :: "x"(0)
    check_as
    BEGIN /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
       1   void foo(void){ __asm__ volatile("vmul.i32 d0, d0, %y0" :: "x"(0)); }
    END /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    /Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/as --sysroot=/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -arch armv7 -no-cpp-precomp -mfpu=neon -mfloat-abi=softfp -ftree-vectorize -ffast-math -funsafe-math-optimizations -fsingle-precision-constant -isysroot /Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk -I/Applications/Xcode5-DP4.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include -mcpu=cortex-a8 -fPIC -c -o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.g896h4Sb.o /var/folders/gx/_k242p6s5cb0hss_pvj4s7vh0000gn/T//ffconf.4wwSSmLm.c
    FATAL:/Applications/Xcode5-DP4.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../libexec/as/arm/as: I don't understand '-' flag!
    check_asm gnu_as ".macro m n
    \n:.int 0
    .endm
    m x"

    Yep, with config --disable-asm would complie but it probably not a option.

  • Python cv2 script that scans a giant image to a video. Raises error : Unknown C++ exception from OpenCV code

    26 avril 2022, par Mahrarena

    I wrote a script that scans a giant image to make a video. Normally I just post my scripts straight to my Code Review account, but this script is ugly, needs to be refactored, implements only horizontal scrolling and contains a bug that I can't get rid of.

    


    It is working but not perfect, I can't get the last line at the bottom of the image, with height of image_height % 1080. If I ignore it, the code is working fine, if I try to fix it, it throws exceptions.

    


    Example :

    


    Original image (Google Drive)

    


    Video Output (Google Drive)

    


    As you can see from the video, everything is working properly except the fact that I can't get the bottom line.

    


    Full working code

    



    

    import cv2
import numpy as np
import random
import rpack
from fractions import Fraction
from math import prod

def resize_guide(image_size, target_area):
    aspect_ratio = Fraction(*image_size).limit_denominator()
    horizontal = aspect_ratio.numerator
    vertical = aspect_ratio.denominator
    unit_length = (target_area/(horizontal*vertical))**.5
    return (int(horizontal*unit_length), int(vertical*unit_length))

fourcc = cv2.VideoWriter_fourcc(*'h264')
FRAME = np.zeros((1080, 1920, 3), dtype=np.uint8)

def new_frame():
    return np.ndarray.copy(FRAME)

def center(image):
    frame = new_frame()
    h, w = image.shape[:2]
    yoff = round((1080-h)/2)
    xoff = round((1920-w)/2)
    frame[yoff:yoff+h, xoff:xoff+w] = image
    return frame

def image_scanning(file, fps=60, pan_increment=64, horizontal_increment=8, fast_decrement=256):
    image = cv2.imread(file)
    height, width = image.shape[:2]
    assert width*height >= 1920*1080
    video_writer = cv2.VideoWriter(file+'.mp4', fourcc, fps, (1920, 1080))
    fit_height = True
    if height < 1080:
        width = width*1080/height
        image = cv2.resize(image, (width, 1080), interpolation = cv2.INTER_AREA)
    aspect_ratio = width / height
    zooming_needed = False
    if 4/9 <= aspect_ratio <= 16/9:
        new_width = round(width*1080/height)
        fit = cv2.resize(image, (new_width, 1080), interpolation = cv2.INTER_AREA)
        zooming_needed = True
    
    elif 16/9 < aspect_ratio <= 32/9:
        new_height = round(height*1920/width)
        fit = cv2.resize(image, (1920, new_height), interpolation = cv2.INTER_AREA)
        fit_height = False
        zooming_needed = True
    
    centered = center(fit)
    for i in range(fps):
        video_writer.write(centered)
    if fit_height:
        xoff = round((1920 - new_width)/2)
        while xoff:
            if xoff - pan_increment >= 0:
                xoff -= pan_increment
            else:
                xoff = 0
            frame = new_frame()
            frame[0:1080, xoff:xoff+new_width] = fit
            video_writer.write(frame)
    else:
        yoff = round((1080 - new_height)/2)
        while yoff:
            if yoff - pan_increment >= 0:
                yoff -= pan_increment
            else:
                yoff = 0
            frame = new_frame()
            frame[yoff:yoff+new_height, 0:1920] = fit
            video_writer.write(frame)
    
    if zooming_needed:
        if fit_height:
            width_1, height_1 = new_width, 1080
        else:
            width_1, height_1 = 1920, new_height
        new_area = width_1 * height_1
        original_area = width * height
        area_diff = original_area - new_area
        unit_diff = area_diff / fps
        for i in range(1, fps+1):
            zoomed = cv2.resize(image, resize_guide((width_1, height_1), new_area+unit_diff*i), interpolation=cv2.INTER_AREA)
            zheight, zwidth = zoomed.shape[:2]
            zheight = min(zheight, 1080)
            zwidth = min(zwidth, 1920)
            frame = new_frame()
            frame[0:zheight, 0:zwidth] = zoomed[0:zheight, 0:zwidth]
            video_writer.write(frame)
    y, x = 0, 0
    completed = False
    while y != height - 1080:
        x = 0
        while x != width - 1920:
            if x + horizontal_increment + 1920 <= width:
                x += horizontal_increment
                frame = image[y:y+1080, x:x+1920]
                video_writer.write(frame)
            else:
                x = width - 1920
                frame = image[y:y+1080, x:x+1920]
                for i in range(round(fps/3)):
                    video_writer.write(frame)
                if y == height - 1080:
                    completed = True
        while x != 0:
            if x - fast_decrement - 1920 >= 0:
                x -= fast_decrement
            else:
                x = 0
            frame = image[y:y+1080, x:x+1920]
            video_writer.write(frame)
        if y + 2160 <= height:
            y += 1080
        else:
            y = height - 1080
    cv2.destroyAllWindows()
    video_writer.release()
    del video_writer


    


    The above the the code needed to produce the example video. It is working but the bottom line is missing.

    


    Now if I change the last few lines to this :

    


            if y + 2160 <= height:
            y += 1080
        else:
            y = height - 1080
            x = 0
            while x != width - 1920:
                if x + horizontal_increment + 1920 <= width:
                    x += horizontal_increment
                    frame = image[y:y+1080, x:x+1920]
                    video_writer.write(frame)
    cv2.destroyAllWindows()
    video_writer.release()
    del video_writer


    


    I expect it to include the bottom line, but it just throws exceptions instead :

    


    OpenCV: FFMPEG: tag 0x34363268/&#x27;h264&#x27; is not supported with codec id 27 and format &#x27;mp4 / MP4 (MPEG-4 Part 14)&#x27;&#xA;OpenCV: FFMPEG: fallback to use tag 0x31637661/&#x27;avc1&#x27;&#xA;---------------------------------------------------------------------------&#xA;error                                     Traceback (most recent call last)&#xA; in <module>&#xA;----> 1 image_scanning("D:/collages/91f53ebcea2a.png")&#xA;&#xA; in image_scanning(file, fps, pan_increment, horizontal_increment, fast_decrement)&#xA;    122                     x &#x2B;= horizontal_increment&#xA;    123                     frame = image[y:y&#x2B;1080, x:x&#x2B;1920]&#xA;--> 124                     video_writer.write(frame)&#xA;    125     cv2.destroyAllWindows()&#xA;    126     video_writer.release()&#xA;&#xA;error: Unknown C&#x2B;&#x2B; exception from OpenCV code&#xA;</module>

    &#xA;

    (If you can't get the example code working I can't help you, but I am using Python 3.9.10 x64 on Windows 10, and I have this file : "C :\Windows\System32\openh264-1.8.0-win64.dll", the '.avi' format generates video files with Gibibytes (binary unit, not SI Gigabyte) of size)

    &#xA;

    How to get rid of the exception ?

    &#xA;


    &#xA;

    Okay I yield, I admit the tone of the original post was very aggressive and provoking, but I was very frustrated and I really don't know why my posts keep getting downvoted. Now I deleted all offending portions so will you people please really have a look at my code and tell me what I did wrong. I can solve it by myself, I always do, but I am so stupid I can spend hours missing the obvious. So please will you help me ?

    &#xA;

  • Of ctors and dtors

    18 février 2011, par Multimedia Mike — Programming, Sega Dreamcast

    I haven’t given up on the Sega Dreamcast programming. I was able to compile a bunch of homebrew code for the DC many years ago and I can’t make it work anymore. Again, I was working with a purpose-built, open source RTOS named KallistiOS (or KOS). I can make the programs compile but not run. I had ELF files left over from years ago which still executed. But when I tried to build new ELF files, no luck— the programs crashed before even reaching my main() function.

    I found the problem : ELF files are comprised of a number of sections and 2 of these sections are named ’.ctors’ and ’.dtors’ which stand for constructors and destructors. The KOS RTOS performs a manual traversal of .ctors section during program initialization and this is where things go bad. The traversal code doesn’t seem to account for a .ctors section that only contains a single entry. I commented out the function that does the traversal and programs started to work, at least until it was time to exit the program and return control to the program loader. That’s when the counterpart .dtors section traversal code ran and demonstrated the same problem. I’ll exhibit the problematic code at the end of this post.

    So I’m finally tinkering with Sega Dreamcast programming once again and with a slightly better grasp of software engineering than the first time I did this.

    Portable and Compatible C ?
    If nothing else, this low-level embedded stuff exposes you to some serious toolchain arcana, the likes of which you will likely never see working strictly in the desktop arena.

    Still, this exercise makes me wonder why C code from a decade ago doesn’t compile reliably now. Part of it is because gcc has gotten stricter about the syntax it will accept. In the case of this specific crashing problem, I suspect it comes down to a difference in the way the linker generates the final ELF file. I’ve written a list of items I have had to modify in the KOS codebase in order to get it to compile on more recent gcc versions. I wonder if it would be worth publishing the specifics, or if anyone would ever find the information useful ? Oh, who am I kidding ? Of course I’ll write it up, perhaps publish a new version of the code, if only because that’s the best chance I have of finding my own work again some years down the road.

    Problematic C Code
    See if this code makes any sense to you. It somehow traverse a list of 32-bit function pointers (in different directions, depending on constructors or destructors), executing each in turn. However, it appears to fall over if the list of pointers consists of a single entry.

    C :
    1. typedef void (*fptr)(void) ;
    2.  
    3. static fptr ctor_list[1] __attribute__((section(".ctors"))) = { (fptr) -1 } ;
    4. static fptr dtor_list[1] __attribute__((section(".dtors"))) = { (fptr) -1 } ;
    5.  
    6. /* Call this to execute all ctors */
    7. void arch_ctors() {
    8.     fptr *fpp ;
    9.  
    10.     /* Run up to the end of the list (defined by crtend) */
    11.     for (fpp=ctor_list + 1 ; *fpp != 0 ; ++fpp)
    12.          ;
    13.  
    14.     /* Now run the ctors backwards */
    15.     while (—fpp> ctor_list)
    16.         (**fpp)() ;
    17. }
    18.  
    19. /* Call this to execute all dtors */
    20. void arch_dtors() {
    21.     fptr *fpp ;
    22.  
    23.     /* Do the dtors forwards */
    24.     for (fpp=dtor_list + 1 ; *fpp != 0 ; ++fpp )
    25.         (**fpp)() ;
    26. }