Recherche avancée

Médias (91)

Autres articles (38)

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

  • Installation en mode standalone

    4 février 2011, par

    L’installation de la distribution MediaSPIP se fait en plusieurs étapes : la récupération des fichiers nécessaires. À ce moment là deux méthodes sont possibles : en installant l’archive ZIP contenant l’ensemble de la distribution ; via SVN en récupérant les sources de chaque modules séparément ; la préconfiguration ; l’installation définitive ;
    [mediaspip_zip]Installation de l’archive ZIP de MediaSPIP
    Ce mode d’installation est la méthode la plus simple afin d’installer l’ensemble de la distribution (...)

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

    8 février 2011, par

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

Sur d’autres sites (6356)

  • Why is recording webcam with FFmpeg much faster with an input format ?

    29 juin 2021, par Alter

    Question is the title

    


    It's a basic question, but one that I can't find clearly answered in google or the documentation, which says :

    


    


    If you specify the input format and device then ffmpeg can grab video and audio directly.

    


    


    This isn't explicit enough for a beginner like me and raises other questions. What does ffmpeg do when the input format isn't specified and why is it so slow ? If ffmpeg can figure out the encoding, doesn't it just do so once ?

    


    Examples

    


    For completeness... I'm using an Rasperry Pi 4 with a Picamera2 to record 1080p

    


    With input format, I get the full 30fps : ffmpeg -input_format h264 -i /dev/video0 -codec h264_v4l2m2m test.h264

    


    Without the input format, I get about 5fps : ffmpeg -i /dev/video0 -codec h264_v4l2m2m test.h264

    


    Note : it will run without the hardware acceleration option -codec h264_v4l2m2m but doesn't reach the full 30fps

    


    Formats

    


    In response to @llogan's comment, the output of v4l2-ctl --list-formats-ext is :

    


    ioctl: VIDIOC_ENUM_FMT
    Type: Video Capture

    [0]: 'YU12' (Planar YUV 4:2:0)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [1]: 'YUYV' (YUYV 4:2:2)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [2]: 'RGB3' (24-bit RGB 8-8-8)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [3]: 'JPEG' (JFIF JPEG, compressed)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [4]: 'H264' (H.264, compressed)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [5]: 'MJPG' (Motion-JPEG, compressed)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [6]: 'YVYU' (YVYU 4:2:2)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [7]: 'VYUY' (VYUY 4:2:2)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [8]: 'UYVY' (UYVY 4:2:2)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [9]: 'NV12' (Y/CbCr 4:2:0)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [10]: 'BGR3' (24-bit BGR 8-8-8)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [11]: 'YV12' (Planar YVU 4:2:0)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [12]: 'NV21' (Y/CrCb 4:2:0)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2
    [13]: 'RX24' (32-bit XBGR 8-8-8-8)
        Size: Stepwise 32x32 - 2592x1944 with step 2/2


    


  • How to "re-interlace" a video ? How to convert a naïvely deinterlaced 480p video back to 480i ? [closed]

    8 juillet 2021, par toughluck

    I have a 480p video that was naïvely created from a 480i original and had no deinterlacing applied. The resulting format is 480p25. Combing is visible and I would like to convert it back to 480i50, so sort of "re-interlace" the video back to its original state.

    


    I have tried the solution from this question : How to convert a 1080p to 1080i using FFMPEG but it did not create the expected output.

    


    I looked at ffmpeg reference here : https://www.ffmpeg.org/ffmpeg-all.html but I could not find a proper option. Tons of filters to deinterlace interlaced videos but nothing to "re-interlace" them.

    


    My expected output would be this :

    


     ------> time
Input:
Frame 1 (0 ms)        Frame 2 (40 ms)

11111                 33333
22222                 44444
11111                 33333
22222                 44444

Output 1:
Frame 1 (0 ms)  Frame 2 (20 ms) Frame 3 (40 ms) Frame 4 (60 ms)
11111           22222           33333           44444
11111           22222           33333           44444
11111           22222           33333           44444
11111           22222           33333           44444

(Alternative) Output 2:
Frame 1 (0 ms)  Frame 2 (20 ms) Frame 3 (40 ms) Frame 4 (60 ms)
22222           11111           44444           33333
22222           11111           44444           33333
22222           11111           44444           33333
22222           11111           44444           33333


    


    (I'm not sure whether it's top field first or bottom field first, so I'd like to have an option to try both.)

    


    Is this possible ?

    


  • ffmpeg - Build HLS stream with all tracks of the input source

    25 juillet 2021, par Kaydee Dunlop

    I would like to create HLS streams for videos. I'm working since more than 2 days now to find a solution that might work but no luck till now to get all tracks of the input inside my HLS output.

    


    What I want in the end is a small script that can merge all tracks form a mp4 imput together and create a proper master.m3u8 playlist referencing all other m3u8 playlists of my m4s, webvtt and audio snippets. Currently I don't have adaptive streaming implemented. To save bandwidth I only want to have one video stream output at a max resolution of 1080p @ 3 Mbit/s.

    


    This is my current state of work, please feel free to to use it :

    


    #!/usr/bin/env bash
LC_NUMERIC="en_US.UTF-8"
START_TIME=$SECONDS
set -e

echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1

# comment/add lines here to control which renditions will be created
renditions=(
# resolution  bitrate  audio-rate
  "1920x1080  3000k    128k"
)

segment_target_duration=20      # try to create a new segment every 10 seconds
max_bitrate_ratio=1.07          # maximum accepted bitrate fluctuations
rate_monitor_buffer_ratio=1.5   # maximum buffer size between bitrate conformance checks

#########################################################################

source="${1}"
target="${2}"
if [[ ! "${target}" ]]; then
  target="${source##*/}" # leave only last component of path
  target="${target%.*}"  # strip extension
fi
mkdir -p ${target}

# ----CUSTOM----
sourceResolution="$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 ${source})"
# echo ${sourceResolution}
arrIN=(${sourceResolution//x/ })
sourceWidth="${arrIN[0]}"
sourceHeight="${arrIN[1]}"

echo ${sourceWidth}
echo ${sourceHeight}

sourceAudioBitRate="$(ffprobe -v error -select_streams a:0 -show_entries stream=bit_rate -of csv=s=x:p=0 ${source})"
sourceAudioBitRateFormatted=$((sourceAudioBitRate / 1000))
# ----END CUSTOM----

key_frames_interval="$(echo `ffprobe ${source} 2>&1 | grep -oE '[[:digit:]]+(.[[:digit:]]+)? fps' | grep -oE '[[:digit:]]+(.[[:digit:]]+)?'`*2 | bc || echo '')"
key_frames_interval=${key_frames_interval:-50}
key_frames_interval=$(echo `printf "%.1f\n" $(bc -l <<<"$key_frames_interval/10")`*10 | bc) # round
key_frames_interval=${key_frames_interval%.*} # truncate to integer

# static parameters that are similar for all renditions
static_params="-c:s webvtt -c:a aac -ar 48000 -c:v copy -sc_threshold 0"
static_params+=" -g ${key_frames_interval} -keyint_min ${key_frames_interval} -hls_time ${segment_target_duration}"
static_params+=" -hls_playlist_type vod -hls_segment_type fmp4"
static_params+=" -var_stream_map v:0,a:0,s:0"

# misc params
misc_params="-hide_banner -y"

master_playlist="#EXTM3U
#EXT-X-VERSION:3
"
cmd=""
resolutionValid=0
prevHeight=0
for rendition in "${renditions[@]}"; do
  # drop extraneous spaces
  rendition="${rendition/[[:space:]]+/ }"

  # rendition fields
  resolution="$(echo ${rendition} | cut -d ' ' -f 1)"
  bitrate="$(echo ${rendition} | cut -d ' ' -f 2)"
  audiorate="$(echo ${rendition} | cut -d ' ' -f 3)"

  audioBitRateFormatted=${audiorate%?} # remove "k" at the last index

  # take highest possible audio bit rate
  if [ $audioBitRateFormatted -gt $sourceAudioBitRateFormatted ]; then
      audiorate=${sourceAudioBitRateFormatted}k
  fi

  # calculated fields
  width="$(echo ${resolution} | grep -oE '^[[:digit:]]+')"
  height="$(echo ${resolution} | grep -oE '[[:digit:]]+$')"
  maxrate="$(echo "`echo ${bitrate} | grep -oE '[[:digit:]]+'`*${max_bitrate_ratio}" | bc)"
  bufsize="$(echo "`echo ${bitrate} | grep -oE '[[:digit:]]+'`*${rate_monitor_buffer_ratio}" | bc)"
  bandwidth="$(echo ${bitrate} | grep -oE '[[:digit:]]+')000"
  name="stream"
  
  widthParam=0
  heightParam=0

  if [ $(((width / sourceWidth) * sourceHeight)) -gt $height ]; then
    widthParam=-2
    heightParam=$height
  else
    widthParam=$width
    heightParam=-2
  fi
  
  #cmd+=" ${static_params} -vf scale=w=${widthParam}:h=${heightParam}"
  cmd+=" -b:v ${bitrate} -maxrate ${maxrate%.*}k -bufsize ${bufsize%.*}k -b:a ${audiorate}"
  cmd+=" -hls_segment_filename ${target}/${name}_%03d.m4s ${target}/${name}.m3u8"
  
  # add rendition entry in the master playlist
  master_playlist+="#EXT-X-STREAM-INF:BANDWIDTH=${bandwidth},RESOLUTION=${resolution}\n${name}.m3u8\n"

  resolutionValid=1
  prevHeight=${height}
done

if [ $resolutionValid -eq 1 ]; then
  # start conversion
  echo -e "Executing command:\nffmpeg ${misc_params} -i ${source} ${cmd}\n"
  ffmpeg ${misc_params} -i ${source} ${cmd}
  # create master playlist file
  echo -e "${master_playlist}" > ${target}/playlist.m3u8
  echo "Done - encoded HLS is at ${target}/"
else
  echo "Video source is too small"
  exit 1
fi

ELAPSED_TIME=$(($SECONDS - $START_TIME))

echo "Elapsed time: ${ELAPSED_TIME}"
echo "-----FINISH GENERATING HLS STREAM-----"