Recherche avancée

Médias (10)

Mot : - Tags -/wav

Autres articles (79)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

  • Mise à jour de la version 0.1 vers 0.2

    24 juin 2013, par

    Explications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
    Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

Sur d’autres sites (15447)

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

  • Video conversion (using ffmpeg) fails only on apache server

    25 avril 2022, par wb.waldemar

    I'm trying to convert a video using latest static build of ffmpeg and following command :

    &#xA;

    ffmpeg -report -y -loglevel info -i en--story-video.mp4 -c:v libx264 -preset slow -crf 22 -c:a copy en--story-video-out.mp4&#xA;

    &#xA;

    This works actually fine on Ubuntu (desktop) and the same command works also on Win 10 but not on the server (Debian GNU/Linux 10) where it should actually work. I can't install or build ffmpeg directly so I've to use a static build. Also simple remux works on the server but not the converion and I do not understand why. I've also read and tried different approaches and suggestions, but none of them could solve the problem.

    &#xA;

    Does someone have an idea what goes wrong ?

    &#xA;

    ffmpeg started on 2022-04-22 at 13:02:44&#xA;Report written to "ffmpeg-20220422-130244.log"&#xA;Log level: 48&#xA;Command line:&#xA;/dev/tools/ffmpeg -report -y -loglevel info -i en--story-video.mp4 -c:v libx264 -preset slow -crf 22 -c:a copy en--story-video-out.mp4&#xA;ffmpeg version N-60837-ge81242bb13-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg&#xA;  libavutil      57. 22.100 / 57. 22.100&#xA;  libavcodec     59. 21.103 / 59. 21.103&#xA;  libavformat    59. 17.102 / 59. 17.102&#xA;  libavdevice    59.  5.100 / 59.  5.100&#xA;  libavfilter     8. 27.100 /  8. 27.100&#xA;  libswscale      6.  5.100 /  6.  5.100&#xA;  libswresample   4.  4.100 /  4.  4.100&#xA;  libpostproc    56.  4.100 / 56.  4.100&#xA;Splitting the commandline.&#xA;Reading option &#x27;-report&#x27; ... matched as option &#x27;report&#x27; (generate a report) with argument &#x27;1&#x27;.&#xA;Reading option &#x27;-y&#x27; ... matched as option &#x27;y&#x27; (overwrite output files) with argument &#x27;1&#x27;.&#xA;Reading option &#x27;-loglevel&#x27; ... matched as option &#x27;loglevel&#x27; (set logging level) with argument &#x27;info&#x27;.&#xA;Reading option &#x27;-i&#x27; ... matched as input url with argument &#x27;en--story-video.mp4&#x27;.&#xA;Reading option &#x27;-c:v&#x27; ... matched as option &#x27;c&#x27; (codec name) with argument &#x27;libx264&#x27;.&#xA;Reading option &#x27;-preset&#x27; ... matched as AVOption &#x27;preset&#x27; with argument &#x27;slow&#x27;.&#xA;Reading option &#x27;-crf&#x27; ... matched as AVOption &#x27;crf&#x27; with argument &#x27;22&#x27;.&#xA;Reading option &#x27;-c:a&#x27; ... matched as option &#x27;c&#x27; (codec name) with argument &#x27;copy&#x27;.&#xA;Reading option &#x27;en--story-video-out.mp4&#x27; ... matched as output url.&#xA;Finished splitting the commandline.&#xA;Parsing a group of options: global .&#xA;Applying option report (generate a report) with argument 1.&#xA;Applying option y (overwrite output files) with argument 1.&#xA;Applying option loglevel (set logging level) with argument info.&#xA;Successfully parsed a group of options.&#xA;Parsing a group of options: input url en--story-video.mp4.&#xA;Successfully parsed a group of options.&#xA;Opening an input file: en--story-video.mp4.&#xA;[NULL @ 0xb9b3b80] Opening &#x27;en--story-video.mp4&#x27; for reading&#xA;[file @ 0xb9b41c0] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] ISO: File Type Major Brand: isom&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Unknown dref type 0x206c7275 size 12&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Processing st: 0, edit list 0 - media time: 512, duration: 522240&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Offset DTS by 512 to make first pts zero.&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Setting codecpar->delay to 2 for stream st: 0&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Unknown dref type 0x206c7275 size 12&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Processing st: 1, edit list 0 - media time: 0, duration: 1502222&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Before avformat_find_stream_info() pos: 15666151 bytes read:88959 seeks:1 nb_streams:2&#xA;[h264 @ 0xb9b6380] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 6(SEI), nal_ref_idc: 0&#xA;[h264 @ 0xb9b6380] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] Format yuv420p chosen by get_format().&#xA;[h264 @ 0xb9b6380] Reinit context to 1920x1088, pix_fmt: yuv420p&#xA;[h264 @ 0xb9b6380] no picture &#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] All info found&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] After avformat_find_stream_info() pos: 43534 bytes read:155045 seeks:2 frames:4&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;en--story-video.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf59.17.102&#xA;  Duration: 00:00:34.06, start: 0.000000, bitrate: 3679 kb/s&#xA;  Stream #0:0[0x1](und), 3, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3544 kb/s, 60 fps, 60 tbr, 15360 tbn (default)&#xA;    Metadata:&#xA;      handler_name    : ISO Media file produced by Google Inc. Created on: 04/10/2019.&#xA;      vendor_id       : [0][0][0][0]&#xA;  Stream #0:1[0x2](eng), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : ISO Media file produced by Google Inc. Created on: 04/10/2019.&#xA;      vendor_id       : [0][0][0][0]&#xA;Successfully opened the file.&#xA;Parsing a group of options: output url en--story-video-out.mp4.&#xA;Applying option c:v (codec name) with argument libx264.&#xA;Applying option c:a (codec name) with argument copy.&#xA;Successfully parsed a group of options.&#xA;Opening an output file: en--story-video-out.mp4.&#xA;[file @ 0xb9fbec0] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;Successfully opened the file.&#xA;detected 20 logical cores&#xA;[h264 @ 0xba04680] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0xba04680] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (copy)&#xA;Press [q] to stop, [?] for help&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba04680] nal_unit_type: 6(SEI), nal_ref_idc: 0&#xA;[h264 @ 0xba04680] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0xba04680] Format yuv420p chosen by get_format().&#xA;[h264 @ 0xba04680] Reinit context to 1920x1088, pix_fmt: yuv420p&#xA;[h264 @ 0xba04680] no picture &#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbaa3b80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;[h264 @ 0xbaa3b80] no picture &#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba067c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba9c2c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba21fc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbab8e80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbac7b00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbad6840] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbae5580] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbaf42c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb03000] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb11d40] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb20a80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb2f7c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb3e500] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb4d240] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba04680] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;[h264 @ 0xbaa3b80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;video_size&#x27; to value &#x27;1920x1080&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;pix_fmt&#x27; to value &#x27;0&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;time_base&#x27; to value &#x27;1/15360&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;pixel_aspect&#x27; to value &#x27;1/1&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;frame_rate&#x27; to value &#x27;60/1&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] w:1920 h:1080 pixfmt:yuv420p tb:1/15360 fr:60/1 sar:1/1&#xA;[format @ 0xbaa0540] Setting &#x27;pix_fmts&#x27; to value &#x27;yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21|yuv420p10le|yuv422p10le|yuv444p10le|nv20le|gray|gray10le&#x27;&#xA;[AVFilterGraph @ 0xba16380] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed&#xA;[libx264 @ 0xba03c80] using mv_range_thread = 24&#xA;[libx264 @ 0xba03c80] using SAR=1/1&#xA;[libx264 @ 0xba03c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height&#xA;[AVIOContext @ 0xb9fba00] Statistics: 0 bytes written, 0 seeks, 0 writeouts&#xA;[AVIOContext @ 0xb9b4480] Statistics: 220581 bytes read, 2 seeks&#xA;Conversion failed!&#xA;

    &#xA;

  • Video conversion (using ffmpeg) fails only on apache server

    25 avril 2022, par wb.waldemar

    I'm trying to convert a video using latest static build of ffmpeg and following command :

    &#xA;

    ffmpeg -report -y -loglevel info -i en--story-video.mp4 -c:v libx264 -preset slow -crf 22 -c:a copy en--story-video-out.mp4&#xA;

    &#xA;

    This works actually fine on Ubuntu (desktop) and the same command works also on Win 10 but not on the server (Debian GNU/Linux 10) where it should actually work. I can't install or build ffmpeg directly so I've to use a static build. Also simple remux works on the server but not the converion and I do not understand why. I've also read and tried different approaches and suggestions, but none of them could solve the problem.

    &#xA;

    Does someone have an idea what goes wrong ?

    &#xA;

    ffmpeg started on 2022-04-22 at 13:02:44&#xA;Report written to "ffmpeg-20220422-130244.log"&#xA;Log level: 48&#xA;Command line:&#xA;/dev/tools/ffmpeg -report -y -loglevel info -i en--story-video.mp4 -c:v libx264 -preset slow -crf 22 -c:a copy en--story-video-out.mp4&#xA;ffmpeg version N-60837-ge81242bb13-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg&#xA;  libavutil      57. 22.100 / 57. 22.100&#xA;  libavcodec     59. 21.103 / 59. 21.103&#xA;  libavformat    59. 17.102 / 59. 17.102&#xA;  libavdevice    59.  5.100 / 59.  5.100&#xA;  libavfilter     8. 27.100 /  8. 27.100&#xA;  libswscale      6.  5.100 /  6.  5.100&#xA;  libswresample   4.  4.100 /  4.  4.100&#xA;  libpostproc    56.  4.100 / 56.  4.100&#xA;Splitting the commandline.&#xA;Reading option &#x27;-report&#x27; ... matched as option &#x27;report&#x27; (generate a report) with argument &#x27;1&#x27;.&#xA;Reading option &#x27;-y&#x27; ... matched as option &#x27;y&#x27; (overwrite output files) with argument &#x27;1&#x27;.&#xA;Reading option &#x27;-loglevel&#x27; ... matched as option &#x27;loglevel&#x27; (set logging level) with argument &#x27;info&#x27;.&#xA;Reading option &#x27;-i&#x27; ... matched as input url with argument &#x27;en--story-video.mp4&#x27;.&#xA;Reading option &#x27;-c:v&#x27; ... matched as option &#x27;c&#x27; (codec name) with argument &#x27;libx264&#x27;.&#xA;Reading option &#x27;-preset&#x27; ... matched as AVOption &#x27;preset&#x27; with argument &#x27;slow&#x27;.&#xA;Reading option &#x27;-crf&#x27; ... matched as AVOption &#x27;crf&#x27; with argument &#x27;22&#x27;.&#xA;Reading option &#x27;-c:a&#x27; ... matched as option &#x27;c&#x27; (codec name) with argument &#x27;copy&#x27;.&#xA;Reading option &#x27;en--story-video-out.mp4&#x27; ... matched as output url.&#xA;Finished splitting the commandline.&#xA;Parsing a group of options: global .&#xA;Applying option report (generate a report) with argument 1.&#xA;Applying option y (overwrite output files) with argument 1.&#xA;Applying option loglevel (set logging level) with argument info.&#xA;Successfully parsed a group of options.&#xA;Parsing a group of options: input url en--story-video.mp4.&#xA;Successfully parsed a group of options.&#xA;Opening an input file: en--story-video.mp4.&#xA;[NULL @ 0xb9b3b80] Opening &#x27;en--story-video.mp4&#x27; for reading&#xA;[file @ 0xb9b41c0] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] ISO: File Type Major Brand: isom&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Unknown dref type 0x206c7275 size 12&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Processing st: 0, edit list 0 - media time: 512, duration: 522240&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Offset DTS by 512 to make first pts zero.&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Setting codecpar->delay to 2 for stream st: 0&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Unknown dref type 0x206c7275 size 12&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Processing st: 1, edit list 0 - media time: 0, duration: 1502222&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] Before avformat_find_stream_info() pos: 15666151 bytes read:88959 seeks:1 nb_streams:2&#xA;[h264 @ 0xb9b6380] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] nal_unit_type: 6(SEI), nal_ref_idc: 0&#xA;[h264 @ 0xb9b6380] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0xb9b6380] Format yuv420p chosen by get_format().&#xA;[h264 @ 0xb9b6380] Reinit context to 1920x1088, pix_fmt: yuv420p&#xA;[h264 @ 0xb9b6380] no picture &#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] All info found&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0xb9b3b80] After avformat_find_stream_info() pos: 43534 bytes read:155045 seeks:2 frames:4&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;en--story-video.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf59.17.102&#xA;  Duration: 00:00:34.06, start: 0.000000, bitrate: 3679 kb/s&#xA;  Stream #0:0[0x1](und), 3, 1/15360: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 3544 kb/s, 60 fps, 60 tbr, 15360 tbn (default)&#xA;    Metadata:&#xA;      handler_name    : ISO Media file produced by Google Inc. Created on: 04/10/2019.&#xA;      vendor_id       : [0][0][0][0]&#xA;  Stream #0:1[0x2](eng), 1, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : ISO Media file produced by Google Inc. Created on: 04/10/2019.&#xA;      vendor_id       : [0][0][0][0]&#xA;Successfully opened the file.&#xA;Parsing a group of options: output url en--story-video-out.mp4.&#xA;Applying option c:v (codec name) with argument libx264.&#xA;Applying option c:a (codec name) with argument copy.&#xA;Successfully parsed a group of options.&#xA;Opening an output file: en--story-video-out.mp4.&#xA;[file @ 0xb9fbec0] Setting default whitelist &#x27;file,crypto,data&#x27;&#xA;Successfully opened the file.&#xA;detected 20 logical cores&#xA;[h264 @ 0xba04680] nal_unit_type: 7(SPS), nal_ref_idc: 3&#xA;[h264 @ 0xba04680] nal_unit_type: 8(PPS), nal_ref_idc: 3&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))&#xA;  Stream #0:1 -> #0:1 (copy)&#xA;Press [q] to stop, [?] for help&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba04680] nal_unit_type: 6(SEI), nal_ref_idc: 0&#xA;[h264 @ 0xba04680] nal_unit_type: 5(IDR), nal_ref_idc: 3&#xA;[h264 @ 0xba04680] Format yuv420p chosen by get_format().&#xA;[h264 @ 0xba04680] Reinit context to 1920x1088, pix_fmt: yuv420p&#xA;[h264 @ 0xba04680] no picture &#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbaa3b80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;[h264 @ 0xbaa3b80] no picture &#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba067c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba9c2c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba21fc0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbab8e80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbac7b00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbad6840] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbae5580] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbaf42c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb03000] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb11d40] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb20a80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb2f7c0] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb3e500] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xbb4d240] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)&#xA;[h264 @ 0xba04680] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 0&#xA;[h264 @ 0xbaa3b80] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 2&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;video_size&#x27; to value &#x27;1920x1080&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;pix_fmt&#x27; to value &#x27;0&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;time_base&#x27; to value &#x27;1/15360&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;pixel_aspect&#x27; to value &#x27;1/1&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] Setting &#x27;frame_rate&#x27; to value &#x27;60/1&#x27;&#xA;[graph 0 input from stream 0:0 @ 0xba9f800] w:1920 h:1080 pixfmt:yuv420p tb:1/15360 fr:60/1 sar:1/1&#xA;[format @ 0xbaa0540] Setting &#x27;pix_fmts&#x27; to value &#x27;yuv420p|yuvj420p|yuv422p|yuvj422p|yuv444p|yuvj444p|nv12|nv16|nv21|yuv420p10le|yuv422p10le|yuv444p10le|nv20le|gray|gray10le&#x27;&#xA;[AVFilterGraph @ 0xba16380] query_formats: 4 queried, 3 merged, 0 already done, 0 delayed&#xA;[libx264 @ 0xba03c80] using mv_range_thread = 24&#xA;[libx264 @ 0xba03c80] using SAR=1/1&#xA;[libx264 @ 0xba03c80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height&#xA;[AVIOContext @ 0xb9fba00] Statistics: 0 bytes written, 0 seeks, 0 writeouts&#xA;[AVIOContext @ 0xb9b4480] Statistics: 220581 bytes read, 2 seeks&#xA;Conversion failed!&#xA;

    &#xA;