Recherche avancée

Médias (3)

Mot : - Tags -/collection

Autres articles (32)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

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

  • Liste des distributions compatibles

    26 avril 2011, par

    Le tableau ci-dessous correspond à la liste des distributions Linux compatible avec le script d’installation automatique de MediaSPIP. Nom de la distributionNom de la versionNuméro de version 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
    Si vous souhaitez nous aider à améliorer cette liste, vous pouvez nous fournir un accès à une machine dont la distribution n’est pas citée ci-dessus ou nous envoyer le (...)

Sur d’autres sites (7660)

  • Open VideoStream using OpenCV 4.5.1 works on Windows but fails on Docker python:3.9.2-slim-buster for specific IP cam

    18 mai 2021, par Qua285

    I have 2 ip cameras - one of Hikvision and another of Provision ISR. Both use Onvif and work on VLC.
I've written a simple python script to record images every 5 sec from their video stream.
On Windows 10, using VSCode they both work as expected. Once deployed to a Docker container, my script works as expected with the Hikvision but fails with the Provision ISR - it doesn't open the stream.

    


    Running python -c "import cv2; print(cv2.getBuildInformation())" on windows (venv 3.9.2) and on docker machine bring slightly different results but it's beyond my understanding to take something out of it...
Here is the Windows one :

    


    General configuration for OpenCV 4.5.1 =====================================
  Version control:               4.5.1

  Platform:
    Timestamp:                   2021-01-02T14:30:58Z
    Host:                        Windows 6.3.9600 AMD64
    CMake:                       3.18.4
    CMake generator:             Visual Studio 14 2015 Win64
    CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe
    MSVC:                        1900

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (15 files):         + SSSE3 SSE4_1
      SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2

  C/C++:
    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.24241.7)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 
/MP  /MT /O2 /Ob2 /DNDEBUG
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 
/MP  /MTd /Zi /Ob0 /Od /RTC1
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP   /MT /O2 /Ob2 /DNDEBUG
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP /MTd /Zi /Ob0 /Od /RTC1
    Linker flags (Release):      /machine:x64  /NODEFAULTLIB:atlthunk.lib /INCREMENTAL:NO  /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:msvcrtd.lib
    Linker flags (Debug):        /machine:x64  /NODEFAULTLIB:atlthunk.lib /debug /INCREMENTAL  /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:msvcrt.lib
    ccache:                      NO
    Precompiled headers:         YES
    Extra dependencies:          ade wsock32 comctl32 gdi32 ole32 setupapi ws2_32
    3rdparty dependencies:       ittnotify libprotobuf zlib libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf quirc ippiw ippicv

  OpenCV modules:
    To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java python2 ts
    Applications:                -
    Documentation:               NO
    Non-free algorithms:         NO

  Windows RT support:            NO

  GUI:
    Win32 UI:                    YES
    VTK support:                 NO

  Media I/O:
    ZLib:                        build (ver 1.2.11)
    JPEG:                        build-libjpeg-turbo (ver 2.0.6-62)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         build (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.0.10)
    JPEG 2000:                   build (ver 2.3.1)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES (prebuilt binaries)
      avcodec:                   YES (58.91.100)
      avformat:                  YES (58.45.100)
      avutil:                    YES (56.51.100)
      swscale:                   YES (5.7.100)
      avresample:                YES (4.0.0)
    GStreamer:                   NO
    DirectShow:                  YES
    Media Foundation:            YES
      DXVA:                      NO

  Parallel framework:            Concurrency

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   C:/Users/appveyor/AppData/Local/Temp/1/pip-req-build-wvn_it83/_skbuild/win-amd64-3.9/cmake-build/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                C:/Users/appveyor/AppData/Local/Temp/1/pip-req-build-wvn_it83/_skbuild/win-amd64-3.9/cmake-build/3rdparty/ippicv/ippicv_win/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.5.1)

  OpenCL:                        YES (NVD3D11)
    Include path:                C:/Users/appveyor/AppData/Local/Temp/1/pip-req-build-wvn_it83/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 C:/Python39-x64/python.exe (ver 3.9)
    Libraries:                   C:/Python39-x64/libs/python39.lib (ver 3.9.0)
    numpy:                       C:/Users/appveyor/AppData/Local/Temp/1/pip-build-env-sk7r7w_5/overlay/Lib/site-packages/numpy/core/include (ver 1.19.3)
    install path:                python

  Python (for build):            C:/Python27-x64/python.exe

  Java:
    ant:                         NO
    JNI:                         C:/Program Files/Java/jdk1.8.0/include C:/Program Files/Java/jdk1.8.0/include/win32 C:/Program Files/Java/jdk1.8.0/include
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    C:/Users/appveyor/AppData/Local/Temp/1/pip-req-build-wvn_it83/_skbuild/win-amd64-3.9/cmake-install
-----------------------------------------------------------------


    


    this is the Docker one (python:3.9.2-slim-buster) :

    


    General configuration for OpenCV 4.5.1 =====================================
  Version control:               4.5.1-dirty

  Platform:
    Timestamp:                   2021-01-02T13:04:10Z
    Host:                        Linux 4.15.0-1077-gcp x86_64
    CMake:                       3.18.4
    CMake generator:             Unix Makefiles
    CMake build tool:            /bin/gmake
    Configuration:               Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (15 files):         + SSSE3 SSE4_1
      SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (4 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (29 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (4 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      NO
    C++ standard:                11
    C++ Compiler:                /usr/lib/ccache/compilers/c++  (ver 9.3.1)
    C++ flags (Release):         -Wl,-strip-all   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -Wl,-strip-all   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/lib/ccache/compilers/cc
    C flags (Release):           -Wl,-strip-all   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -Wl,-strip-all   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections  -msse -msse2 -msse3 -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib  -Wl,--gc-sections -Wl,--as-needed
    Linker flags (Debug):        -Wl,--exclude-libs,libippicv.a -Wl,--exclude-libs,libippiw.a -L/root/ffmpeg_build/lib  -Wl,--gc-sections -Wl,--as-needed
    ccache:                      YES
    Precompiled headers:         NO
    Extra dependencies:          ade Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Test Qt5::Concurrent /lib64/libpng.so /lib64/libz.so dl m pthread rt
    3rdparty dependencies:       ittnotify libprotobuf libjpeg-turbo libwebp libtiff libopenjp2 IlmImf quirc ippiw ippicv

  OpenCV modules:
    To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java python2 ts
    Applications:                -
    Documentation:               NO
    Non-free algorithms:         NO

  GUI:
    QT:                          YES (ver 5.15.0)
      QT OpenGL support:         NO
    GTK+:                        NO
    VTK support:                 NO

  Media I/O:
    ZLib:                        /lib64/libz.so (ver 1.2.7)
    JPEG:                        libjpeg-turbo (ver 2.0.6-62)
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         /lib64/libpng.so (ver 1.5.13)
    TIFF:                        build (ver 42 - 4.0.10)
    JPEG 2000:                   build (ver 2.3.1)
    OpenEXR:                     build (ver 2.3.0)
    HDR:                         YES
    SUNRASTER:                   YES
    PXM:                         YES
    PFM:                         YES

  Video I/O:
    DC1394:                      NO
    FFMPEG:                      YES
      avcodec:                   YES (58.109.100)
      avformat:                  YES (58.61.100)
      avutil:                    YES (56.60.100)
      swscale:                   YES (5.8.100)
      avresample:                NO
    GStreamer:                   NO
    v4l/v4l2:                    YES (linux/videodev2.h)

  Parallel framework:            pthreads

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   /tmp/pip-req-build-ddpkm6fn/_skbuild/linux-x86_64-3.9/cmake-build/3rdparty/ippicv/ippicv_lnx/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                /tmp/pip-req-build-ddpkm6fn/_skbuild/linux-x86_64-3.9/cmake-build/3rdparty/ippicv/ippicv_lnx/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.5.1)

  OpenCL:                        YES (no extra features)
    Include path:                /tmp/pip-req-build-ddpkm6fn/opencv/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 /opt/python/cp39-cp39/bin/python (ver 3.9)
    Libraries:                   libpython3.9.a (ver 3.9.0)
    numpy:                       /tmp/pip-build-env-jqrfyj0w/overlay/lib/python3.9/site-packages/numpy/core/include (ver 1.19.3)
    install path:                python

  Python (for build):            /bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Install to:                    /tmp/pip-req-build-ddpkm6fn/_skbuild/linux-x86_64-3.9/cmake-install
-----------------------------------------------------------------


    


    If relevant, the docker is installed on an Intel NUC with Ubuntu Desktop 20.04

    


    If relevant, this is the dockerfile I've used to build the image :

    


    FROM python:3.9.2-slim-buster as builder

# Keeps Python from generating .pyc files in the container
ENV PYTHONDONTWRITEBYTECODE=1
# Without this setting, Python never prints anything out.
ENV PYTHONUNBUFFERED=1

RUN pip install --upgrade pip
COPY ./Cam/requirements.txt .
RUN pip install -r requirements.txt
RUN apt-get update
RUN apt-get install ffmpeg libsm6 libxext6 -y

WORKDIR /app

FROM builder
COPY ./Cam .
CMD ["python", "camStreamer.py"]


    


    and last, this is the script code (simplified) :

    


    import os, logging, threading
from os.path import join
import sys, inspect, datetime, time
from pathlib import Path
import cv2
import imutils
from imutils.video import VideoStream

def StartRecording(showVideoWindow, interval, imagePath):
    key = None
    cam = VideoStream(os.getenv("CAM_RTSP")).start()
    counter = 0
    try:
        while True:
            ## 2 min retry to connect if frame is None
            if counter > 60/interval*2: break

            ts = time.time()
            ## Wait for [interval] seconds
            while ts + interval > time.time():
                continue
            print(f"Counter: {counter}, ts: {str(ts)}")

            frame = cam.read()
            if frame is None:
                counter += 1
                continue
            counter = 0

            print("frame is valid")
            if showVideoWindow:
                frame = imutils.resize(frame, width=1200)
                cv2.imshow('VIDEO', frame)

            imageName = f"{datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%dT%H_%M_%S')}.jpg"
            cv2.imwrite(join(imagePath, imageName), frame)
            print("saved image to disk")

            key = cv2.waitKey(1) & 0xFF
            if key == ord('q') or key == ord('r'):
                break

    except Exception as e:
        exc_tb = sys.exc_info()[2]
        extra = ""
        print(f"{inspect.stack()[0][3]}: {e} (lineno: {exc_tb.tb_lineno}) {extra}")
    finally:
        if showVideoWindow: cv2.destroyAllWindows()
        cam.stop()
        return key


while True:
    log.warning(f"Starting {Name}")
    key = StartRecording(
                showVideoWindow=(Env.startswith("development") and os.getenv("SHOW_VIDEO") == "True"),
                interval=int(os.getenv("SAVE_IMAGE_INTERVAL")),
                imagePath=os.getenv('CAPTURE_FOLDER')
                )
    if key == ord('q'):
        break


    


    I apologize for the very long post. Hopefully someone can put me on the right direction...

    


  • Decrypting fragmented mpeg-dash using ffmpeg

    6 octobre 2022, par Sayem Prodhan Ananta

    I have an mpeg-dash which I want to decrypt. I have the CENC decryption key. But I am unable to get it working. The dash uses segment template. Here is the dash

    


    &lt;?xml version="1.0" ?>&#xA;<mpd mediapresentationduration="PT1H55M53.987S" minbuffertime="PT6.00S" profiles="urn:mpeg:dash:profile:isoff-live:2011" type="static" xmlns="urn:mpeg:dash:schema:mpd:2011">&#xA;  &#xA;  <period>&#xA;    &#xA;    <adaptationset maxheight="720" maxwidth="1280" mimetype="video/mp4" segmentalignment="true" startwithsap="1">&#xA;      <accessibility schemeiduri="urn:scte:dash:cc:cea-608:2015" value="eng"></accessibility>&#xA;      <viewpoint schemeiduri="urn:mpeg:dash:role:2011" value="vp2"></viewpoint>&#xA;      &#xA;      <contentprotection schemeiduri="urn:mpeg:dash:mp4protection:2011" value="cenc"></contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">&#xA;        pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA&#x2B;ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA&#x2B;ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA&#x2B;AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA&#x2B;ADwALwBXAFIATQBIAEUAQQBEAEUAUgA&#x2B;AA==&#xA;      </contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">&#xA;        AAAAQ3Bzc2gAAAAA7e&#x2B;LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==&#xA;      </contentprotection>&#xA;      <segmenttemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startnumber="1" timescale="1000"></segmenttemplate>&#xA;      <representation bandwidth="634478" codecs="avc1.4D401F" framerate="2997/100" height="288" scantype="progressive" width="512"></representation>&#xA;      <representation bandwidth="789637" codecs="avc1.4D401F" framerate="2997/100" height="360" scantype="progressive" width="640"></representation>&#xA;      <representation bandwidth="1562569" codecs="avc1.4D401F" framerate="2997/100" height="432" scantype="progressive" width="768"></representation>&#xA;      <representation bandwidth="2124583" codecs="avc1.4D401F" framerate="2997/100" height="720" scantype="progressive" width="1280"></representation>&#xA;    </adaptationset>&#xA;    &#xA;    <adaptationset lang="en" mimetype="audio/mp4" segmentalignment="true" startwithsap="1">&#xA;      &#xA;      <contentprotection schemeiduri="urn:mpeg:dash:mp4protection:2011" value="cenc"></contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95">&#xA;        pAIAAAEAAQCaAjwAVwBSAE0ASABFAEEARABFAFIAIAB4AG0AbABuAHMAPQAiAGgAdAB0AHAAOgAvAC8AcwBjAGgAZQBtAGEAcwAuAG0AaQBjAHIAbwBzAG8AZgB0AC4AYwBvAG0ALwBEAFIATQAvADIAMAAwADcALwAwADMALwBQAGwAYQB5AFIAZQBhAGQAeQBIAGUAYQBkAGUAcgAiACAAdgBlAHIAcwBpAG8AbgA9ACIANAAuADAALgAwAC4AMAAiAD4APABEAEEAVABBAD4APABQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsARQBZAEwARQBOAD4AMQA2ADwALwBLAEUAWQBMAEUATgA&#x2B;ADwAQQBMAEcASQBEAD4AQQBFAFMAQwBUAFIAPAAvAEEATABHAEkARAA&#x2B;ADwALwBQAFIATwBUAEUAQwBUAEkATgBGAE8APgA8AEsASQBEAD4AOABoAFcAMwBQAEsAeABPAEkAYwB1AGsAVwBWAHgASwBaAHgAMgA3AEMAZwA9AD0APAAvAEsASQBEAD4APABDAEgARQBDAEsAUwBVAE0APgBBAGQARgAvAFEAcwBzAHEATQBhAEEAPQA8AC8AQwBIAEUAQwBLAFMAVQBNAD4APABMAEEAXwBVAFIATAA&#x2B;AGgAdAB0AHAAOgAvAC8AcAByAC4AcwBlAHIAdgBpAGMAZQAuAGUAeABwAHIAZQBzAHMAcABsAGEAeQAuAGMAbwBtAC8AcABsAGEAeQByAGUAYQBkAHkALwBSAGkAZwBoAHQAcwBNAGEAbgBhAGcAZQByAC4AYQBzAG0AeAA8AC8ATABBAF8AVQBSAEwAPgA8AC8ARABBAFQAQQA&#x2B;ADwALwBXAFIATQBIAEUAQQBEAEUAUgA&#x2B;AA==&#xA;      </contentprotection>&#xA;      &#xA;      <contentprotection schemeiduri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">&#xA;        AAAAQ3Bzc2gAAAAA7e&#x2B;LqXnWSs6jyCfc1R0h7QAAACMIARIQPLcV8k6syyGkWVxKZx27ChoKaW50ZXJ0cnVzdCIBKg==&#xA;      </contentprotection>&#xA;      <segmenttemplate duration="6000" initialization="$RepresentationID$/init.mp4" media="$RepresentationID$/seg-$Number$.m4s" startnumber="1" timescale="1000"></segmenttemplate>&#xA;      <representation audiosamplingrate="48000" bandwidth="136225" codecs="mp4a.40.2">&#xA;        <audiochannelconfiguration schemeiduri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"></audiochannelconfiguration>&#xA;      </representation>&#xA;    </adaptationset>&#xA;  </period>&#xA;</mpd>&#xA;

    &#xA;

    I have produced an mp4 file by combining all the segments like this

    &#xA;

    init.mp4&#x2B;seg-1.m4s&#x2B;seg-2.m4s&#x2B;....&#x2B;seg-1159.m4s&#xA;

    &#xA;

    But I end up with following error

    &#xA;

    ffmpeg version N-99631-g9018257751-anan5a-2020-10-19 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 8 (Debian 8.3.0-6)&#xA;  configuration: --extra-version=anan5a-2020-10-19 --enable-gpl --enable-version3 --disable-shared --enable-static --enable-small --enable-avisynth --enable-chromaprint --enable-frei0r --enable-gmp --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-librtmp --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-openal --enable-opencl --enable-opengl --enable-libdrm --enable-nonfree --enable-libfdk-aac --enable-libbluray --enable-libzimg --enable-libsvtav1&#xA;  libavutil      56. 60.100 / 56. 60.100&#xA;  libavcodec     58.111.101 / 58.111.101&#xA;  libavformat    58. 62.100 / 58. 62.100&#xA;  libavdevice    58. 11.102 / 58. 11.102&#xA;  libavfilter     7. 87.100 /  7. 87.100&#xA;  libswscale      5.  8.100 /  5.  8.100&#xA;  libswresample   3.  8.100 /  3.  8.100&#xA;  libpostproc    55.  8.100 / 55.  8.100&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Incorrect number of samples in encryption info&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s): unspecified pixel format&#xA;Consider increasing the value for the &#x27;analyzeduration&#x27; (0) and &#x27;probesize&#x27; (5000000) options&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;../videos/enc.0a7bd4e9ec72b6e0-5549.mkv&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41iso5iso6&#xA;  Duration: 01:55:47.95, bitrate: 625 kb/s&#xA;    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288, 616 kb/s, SAR 1:1 DAR 16:9, 29.97 fps, 11988 tbr, 11988 tbn, 23976 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Bento4 Video Handler&#xA;    Side data:&#xA;      unknown side data type 24 (779 bytes)&#xA;Output #0, matroska, to &#x27;../videos/dec.0a7bd4e9ec72b6e0-5549.mkv&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41iso5iso6&#xA;    encoder         : Lavf58.62.100&#xA;    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 512x288 [SAR 1:1 DAR 16:9], q=2-31, 616 kb/s, 29.97 fps, 11988 tbr, 1k tbn, 11988 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : Bento4 Video Handler&#xA;    Side data:&#xA;      unknown side data type 24 (779 bytes)&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (copy)&#xA;Press [q] to stop, [?] for help&#xA;[mov,mp4,m4a,3gp,3g2,mj2 @ 0x557789b49300] Incorrect number of samples in encryption info&#xA;../videos/enc.0a7bd4e9ec72b6e0-5549.mkv: Invalid data found when processing input&#xA;frame=    0 fps=0.0 q=-1.0 Lsize=       1kB time=00:00:00.00 bitrate=N/A speed=   0x    &#xA;video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown&#xA;

    &#xA;

    How can I achieve the decryption without error ??

    &#xA;

  • Using FFmpeg with URL input causes SIGSEGV in AWS Lambda (Python runtime)

    26 mars, par Dave94

    I'm trying to implement a video converting solution on AWS Lambda following their article named Processing user-generated content using AWS Lambda and FFmpeg.&#xA;However when I run my command with subprocess.Popen() it returns -11 which translates to SIGSEGV (segmentation fault).&#xA;I've tried to process the video with the newest (4.3.1) static build from John Van Sickle's site as with the "official" ffmpeg-lambda-layer but it seems like it doesn't matter which one I use, the result is the same.

    &#xA;

    If I download the video to the Lambda's /tmp directory and add this downloaded file as an input to FFmpeg it works correctly (with the same parameters). However I'm trying to prevent this as the /tmp directory's max. size is only 512 MB which is not quite enough for me.

    &#xA;

    The relevant code which returns SIGSEGV :

    &#xA;

    ffmpeg_cmd = &#x27;/opt/bin/ffmpeg -stream_loop -1 -i "&#x27; &#x2B; s3_source_signed_url &#x2B; &#x27;" -i /opt/bin/audio.mp3 -i /opt/bin/watermark.png -shortest -y -deinterlace -vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 30 -g 60 -b:v 4500k -c:a copy -map 0:v:0 -map 1:a:0 -filter_complex scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,overlay=(W-w)/2:(H-h)/2,format=yuv420p -loglevel verbose -f flv -&#x27;&#xA;command1 = shlex.split(ffmpeg_cmd)&#xA;p1 = subprocess.Popen(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)&#xA;stdout, stderr = p1.communicate()&#xA;print(p1.returncode) #prints -11&#xA;

    &#xA;

    stderr of FFmpeg :

    &#xA;

    ffmpeg version 4.1.3-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with gcc 6.3.0 (Debian 6.3.0-18&#x2B;deb9u1) 20170516&#xA;  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzvbi --enable-libzimg&#xA;  libavutil      56. 22.100 / 56. 22.100&#xA;  libavcodec     58. 35.100 / 58. 35.100&#xA;  libavformat    58. 20.100 / 58. 20.100&#xA;  libavdevice    58.  5.100 / 58.  5.100&#xA;  libavfilter     7. 40.101 /  7. 40.101&#xA;  libswscale      5.  3.100 /  5.  3.100&#xA;  libswresample   3.  3.100 /  3.  3.100&#xA;  libpostproc    55.  3.100 / 55.  3.100&#xA;[tcp @ 0x728cc00] Starting connection attempt to 52.219.74.177 port 443&#xA;[tcp @ 0x728cc00] Successfully connected to 52.219.74.177 port 443&#xA;[h264 @ 0x729b780] Reinit context to 1280x720, pix_fmt: yuv420p&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;https://bucket.s3.amazonaws.com --> presigned url with 15 min expiration time&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42mp41isomavc1&#xA;    creation_time   : 2015-09-02T07:42:42.000000Z&#xA;  Duration: 00:00:15.64, start: 0.000000, bitrate: 2640 kb/s&#xA;    Stream #0:0(und): Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt709, left), 1280x720 [SAR 1:1 DAR 16:9], 2475 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-09-02T07:42:42.000000Z&#xA;      handler_name    : L-SMASH Video Handler&#xA;      encoder         : AVC Coding&#xA;    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default)&#xA;    Metadata:&#xA;      creation_time   : 2015-09-02T07:42:42.000000Z&#xA;      handler_name    : L-SMASH Audio Handler&#xA;[mp3 @ 0x733f340] Skipping 0 bytes of junk at 1344.&#xA;Input #1, mp3, from &#x27;/opt/bin/audio.mp3&#x27;:&#xA;  Metadata:&#xA;    encoded_by      : Logic Pro X&#xA;    date            : 2021-01-03&#xA;    coding_history  : &#xA;    time_reference  : 158760000&#xA;    umid            : 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004500F9E4&#xA;    encoder         : Lavf58.49.100&#xA;  Duration: 00:04:01.21, start: 0.025057, bitrate: 320 kb/s&#xA;    Stream #1:0: Audio: mp3, 44100 Hz, stereo, fltp, 320 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.97&#xA;Input #2, png_pipe, from &#x27;/opt/bin/watermark.png&#x27;:&#xA;  Duration: N/A, bitrate: N/A&#xA;    Stream #2:0: Video: png, 1 reference frame, rgba(pc), 701x190 [SAR 1521:1521 DAR 701:190], 25 tbr, 25 tbn, 25 tbc&#xA;[Parsed_scale_0 @ 0x7341140] w:1920 h:1080 flags:&#x27;bilinear&#x27; interl:0&#xA;Stream mapping:&#xA;  Stream #0:0 (h264) -> scale&#xA;  Stream #2:0 (png) -> overlay:overlay&#xA;  format -> Stream #0:0 (libx264)&#xA;  Stream #1:0 -> #0:1 (copy)&#xA;Press [q] to stop, [?] for help&#xA;[h264 @ 0x72d8600] Reinit context to 1280x720, pix_fmt: yuv420p&#xA;[Parsed_scale_0 @ 0x733c1c0] w:1920 h:1080 flags:&#x27;bilinear&#x27; interl:0&#xA;[graph 0 input from stream 0:0 @ 0x7669200] w:1280 h:720 pixfmt:yuv420p tb:1/25 fr:25/1 sar:1/1 sws_param:flags=2&#xA;[graph 0 input from stream 2:0 @ 0x766a980] w:701 h:190 pixfmt:rgba tb:1/25 fr:25/1 sar:1521/1521 sws_param:flags=2&#xA;[auto_scaler_0 @ 0x7670240] w:iw h:ih flags:&#x27;bilinear&#x27; interl:0&#xA;[deinterlace_in_2_0 @ 0x766b680] auto-inserting filter &#x27;auto_scaler_0&#x27; between the filter &#x27;graph 0 input from stream 2:0&#x27; and the filter &#x27;deinterlace_in_2_0&#x27;&#xA;[Parsed_scale_0 @ 0x733c1c0] w:1280 h:720 fmt:yuv420p sar:1/1 -> w:1920 h:1080 fmt:yuv420p sar:1/1 flags:0x2&#xA;[Parsed_pad_1 @ 0x733ce00] w:1920 h:1080 -> w:1920 h:1080 x:0 y:0 color:0x000000FF&#xA;[Parsed_setsar_2 @ 0x733da00] w:1920 h:1080 sar:1/1 dar:16/9 -> sar:1/1 dar:16/9&#xA;[auto_scaler_0 @ 0x7670240] w:701 h:190 fmt:rgba sar:1521/1521 -> w:701 h:190 fmt:yuva420p sar:1/1 flags:0x2&#xA;[Parsed_overlay_3 @ 0x733e440] main w:1920 h:1080 fmt:yuv420p overlay w:701 h:190 fmt:yuva420p&#xA;[Parsed_overlay_3 @ 0x733e440] [framesync @ 0x733e5a8] Selected 1/50 time base&#xA;[Parsed_overlay_3 @ 0x733e440] [framesync @ 0x733e5a8] Sync level 2&#xA;[libx264 @ 0x72c1c00] using SAR=1/1&#xA;[libx264 @ 0x72c1c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 0x72c1c00] profile Progressive High, level 4.0, 4:2:0, 8-bit&#xA;[libx264 @ 0x72c1c00] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=9 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=10 rc=abr mbtree=1 bitrate=4500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00&#xA;Output #0, flv, to &#x27;pipe:&#x27;:&#xA;  Metadata:&#xA;    major_brand     : mp42&#xA;    minor_version   : 0&#xA;    compatible_brands: mp42mp41isomavc1&#xA;    encoder         : Lavf58.20.100&#xA;    Stream #0:0: Video: h264 (libx264), 1 reference frame ([7][0][0][0] / 0x0007), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 4500 kb/s, 30 fps, 1k tbn, 30 tbc (default)&#xA;    Metadata:&#xA;      encoder         : Lavc58.35.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 0/0/4500000 buffer size: 0 vbv_delay: -1&#xA;    Stream #0:1: Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, fltp, 320 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.97&#xA;frame=   27 fps=0.0 q=32.0 size=     247kB time=00:00:00.03 bitrate=59500.0kbits/s speed=0.0672x&#xA;frame=   77 fps= 77 q=27.0 size=    1115kB time=00:00:02.03 bitrate=4478.0kbits/s speed=2.03x&#xA;frame=  126 fps= 83 q=25.0 size=    2302kB time=00:00:04.00 bitrate=4712.4kbits/s speed=2.64x&#xA;frame=  177 fps= 87 q=26.0 size=    3576kB time=00:00:06.03 bitrate=4854.4kbits/s speed=2.97x&#xA;frame=  225 fps= 88 q=25.0 size=    4910kB time=00:00:07.96 bitrate=5047.8kbits/s speed=3.13x&#xA;frame=  272 fps= 89 q=27.0 size=    6189kB time=00:00:09.84 bitrate=5147.9kbits/s speed=3.22x&#xA;frame=  320 fps= 90 q=27.0 size=    7058kB time=00:00:11.78 bitrate=4907.5kbits/s speed=3.31x&#xA;frame=  372 fps= 91 q=26.0 size=    8098kB time=00:00:13.84 bitrate=4791.0kbits/s speed=3.4x&#xA;

    &#xA;

    And that's the end of it. It should continue to do the processing until 00:04:02 as that's my audio's length but it stops here every time (approximately this is my video length).

    &#xA;

    The relevant code which works correctly :

    &#xA;

    ffmpeg_cmd = &#x27;/opt/bin/ffmpeg -stream_loop -1 -i "&#x27; &#x2B; &#x27;/tmp/&#x27; &#x2B; s3_source_key &#x2B; &#x27;" -i /opt/bin/audio.mp3 -i /opt/bin/watermark.png -shortest -y -deinterlace -vcodec libx264 -pix_fmt yuv420p -preset veryfast -r 30 -g 60 -b:v 4500k -c:a copy -map 0:v:0 -map 1:a:0 -filter_complex scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,setsar=1,overlay=(W-w)/2:(H-h)/2,format=yuv420p -loglevel verbose -f flv -&#x27;&#xA;command1 = shlex.split(ffmpeg_cmd)&#xA;p1 = subprocess.Popen(command1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)&#xA;stdout, stderr = p1.communicate()&#xA;print(p1.returncode) #prints 0&#xA;

    &#xA;

    With this code it repeats the video as many times as it has to do to be as long as the audio.

    &#xA;

    Both versions work correctly on my computer.

    &#xA;

    This question is almost the same but in my case FFmpeg is able to access the signed URL.

    &#xA;