Recherche avancée

Médias (0)

Mot : - Tags -/logo

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (102)

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

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (10380)

  • FFmpeg capture, mkvtimestamp_v2 and timecode don't play nice

    24 mai 2021, par Bouke

    Trying to capture and modify the TC in-file afterwards.
I've found a nice way to store the timestamps from the capture.
Gyan's brillant filterchain

    


    This works fine using this line :

    


    ffmpeg -hide_banner -f "decklink" -queue_size "1073741824" -raw_format "auto" -format_code "Hi50" -video_input "sdi" -i "bm mini One" -filter_complex "settb=1/1000,setpts=RTCTIME/1000-1500000000000,mpdecimate,split[out][ts];[out]setpts=N/25/TB[out]" -map "[out]" -c:a "copy" -c:v "prores" -profile:v "1" -vendor "ap10" -pix_fmt "yuv422p10le" "/Volumes/Data/tst1.mov" -map "[ts]" -f mkvtimestamp_v2 "/Volumes/Data/time.txt" -vsync 0


    


    But, when I add -timecode "00:00:00:00" (to force a TC atom in the output), horrible things happen.

    


    ffmpeg -f "decklink" -queue_size "1073741824" -raw_format "auto" -format_code "Hi50" -video_input "sdi" -i "bm mini One" -filter_complex "settb=1/1000,setpts=RTCTIME/1000-1500000000000,mpdecimate,split[out][ts];[out]setpts=N/25/TB[out]" -map "[out]" -timecode "00:01:00:00" -c:a "copy" -c:v "prores" -profile:v "1" -vendor "ap10" -pix_fmt "yuv422p10le" "/Volumes/Data/tst1.mov" -map "[ts]" -f mkvtimestamp_v2 "/Volumes/Data/time.txt" -vsync 0


    


    The timecode does not run at the video speed, skips a frame or two here and there, and the image freezes after a random amount of time (between 10 seconds and a minute or so).

    


    How come the timecode can mess up stuff that much ? From what I understand it's just a couple of atoms in the moov atom, and a reference where the actual TC value (as frames) is stored in the mdat.

    


    I highly suspect the -vsync 0 to also work on the video, and I've had issues with that before. If I omit that, the video is fine, the TC is fine, but there is no metadata output, just the # timecode format v2

    


  • Unable to retrieve video stream from RTSP URL inside Docker container

    6 février, par birdalugur

    I have a FastAPI application running inside a Docker container that is trying to stream video from an RTSP camera URL using OpenCV. The setup works fine locally, but when running inside Docker, the /video endpoint does not return a stream and times out. Below are the details of the issue.

    


    Docker Setup :

    


    Dockerfile :

    


    FROM python:3.10.12

RUN apt-get update && apt-get install -y \
    libgl1-mesa-glx \
    libglib2.0-0

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD ["python", "app.py"]



    


      

    • Docker Compose :
    • 


    


    services:
  api:
    build: ./api
    ports:
      - "8000:8000"
    depends_on:
      - redis
      - mongo
    networks:
      - app_network
    volumes:
      - ./api:/app
    environment:
      - REDIS_HOST=redis
      - REDIS_PORT=6379
      - MONGO_URI=mongodb://mongo:27017/app_db

  frontend:
    build: ./frontend
    ports:
      - "3000:3000"
    depends_on:
      - api
    networks:
      - app_network
    volumes:
      - ./frontend:/app
      - /app/node_modules

redis:
    image: "redis:alpine"
    restart: always
    networks:
      - app_network
    volumes:
      - redis_data:/data

  mongo:
    image: "mongo:latest"
    restart: always
    networks:
      - app_network
    volumes:
      - mongo_data:/data/db

networks:
  app_network:
    driver: bridge

volumes:
  redis_data:
  mongo_data:



    


    Issue :

    


    When I try to access the /video endpoint, the following warnings appear :

    


    [ WARN:0@46.518] global cap_ffmpeg_impl.hpp:453 _opencv_ffmpeg_interrupt_callback Stream timeout triggered after 30037.268665 ms


    


    However, locally, the RTSP stream works fine using OpenCV with the same code.

    


    Additional Information :

    


      

    1. Network : The Docker container can successfully ping the camera IP (10.100.10.94).
    2. 


    3. Local Video : I can read frames from a local video file without issues.
    4. 


    5. RTSP Stream : I am able to access the RTSP stream directly using OpenCV locally, but not inside the Docker container.
    6. 


    


    Code :

    


    Here's the relevant part of the code in my api/app.py :

    


    import cv2
from fastapi import FastAPI
from fastapi.responses import StreamingResponse

RTSP_URL = "rtsp://deneme:155115@10.100.10.94:554/axis-media/media.amp?adjustablelivestream=1&fps=10"

def generate_frames():
    cap = cv2.VideoCapture(RTSP_URL)
    if not cap.isOpened():
        print("Failed to connect to RTSP stream.")
        return

    while True:
        success, frame = cap.read()
        if not success:
            print("Failed to capture frame.")
            break

        _, buffer = cv2.imencode(".jpg", frame)
        frame_bytes = buffer.tobytes()

        yield (
            b"--frame\r\n" b"Content-Type: image/jpeg\r\n\r\n" + frame_bytes + b"\r\n"
        )

    cap.release()

@app.get("/video")
async def video_feed():
    """Return MJPEG stream to the browser."""
    return StreamingResponse(
        generate_frames(), media_type="multipart/x-mixed-replace; boundary=frame"
    )


    


    Has anyone faced similar issues or have suggestions on how to resolve this ?

    



    

  • ffmpeg command in my Python code is not working in Docker

    12 juin 2024, par Akhil Varghese

    I am developing a Python (Django-REST) app for video processing. I need to extract the frames of videos and need to save a live stream(RSTP stream) to the desired directory.
I am using ffmpeg for saving the RTSP stream, and I have also Dockerized the app.

    


      

    • Live Stream save method
    • 


    


    import subprocess
@api_view(['POST'])
def saveRtsp(request):
    logger.info("Saving RTSP URL")
    rtsp_url = 'rtsp://192.168.1.117/sample2.mkv'
    rtsp_video_path = 'rtsp.mp4'
    try:
        ffmpeg_command = [
            'ffmpeg',
            '-y',
            "-analyzeduration", "20000000",
            "-probesize", "10000000",
            "-rtsp_transport", "tcp",
            "-r", "30",
            "-i", rtsp_url,
            "-c:v", "copy",
            "-b:v", "1M",
            "-c:a", "copy",
            "-b:a", "128k",
            "-f", "mp4",
            rtsp_video_path
        ]
      
      subprocess.run(ffmpeg_command)
      return True
    except Exception as e:
        logger.error(f"Failed to save RTSP URL: {e}")
        return False


    


    This is actually saving a video file in my directory with properties (as shown by "Get Info" in the MacOS Finder) :

    


    enter image description here

    


    As shown in the image, the video doesn't have the resolution and codec information, so it's not compatible with players.

    


    However, If I execute the following command directly in the Docker container shell, I get a compatible video.

    


    A valid video information :

    


    enter image description here

    


    As shown in the image, a compatible video has the Dimension, codecs, and Duration details in the more info section.

    


    ffmpeg -analyzeduration 20000000 -probesize 10000000 -rtsp_transport tcp -r 30  -i rtsp://xx.xx.xx.xx/sample2.mkv -c:v copy -b:v 1M -c:a copy -b:a 128k -f mp4 testoutput2.mp4


    


    My Dockerfile is :

    


    FROM python:3.9-slim

# Set environment variables
ENV PYTHONUNBUFFERED 1

# Set the working directory in the container
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    ffmpeg \
    libsm6 \
    libxext6 \
    libx264-dev \
    libopencv-dev \
    && apt-get clean

# Copy the requirements file into the container
COPY requirements.txt /app/requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir -r /app/requirements.txt

# Copy the current directory contents into the container at /app
COPY . /app/

# Expose the port the app runs on
EXPOSE 8000

# Run the Django development server
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]


    


    Why does the strange behaviour happen ?
How can I fix this issue ?

    


    I tried using different codecs and even the ffmpeg-python library,
but still getting the same result.