
Recherche avancée
Médias (2)
-
Granite de l’Aber Ildut
9 septembre 2011, par
Mis à jour : Septembre 2011
Langue : français
Type : Texte
-
Géodiversité
9 septembre 2011, par ,
Mis à jour : Août 2018
Langue : français
Type : Texte
Autres articles (79)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (4504)
-
How to take screenshots of streamers using the Twitch API
10 décembre 2020, par oo92My goal is to create a dataset of gameplays on Twitch using the API. How I want to do it is this :


- 

- Get a list of live streams using the API.
- Use streamlink and ffmpeg on Python to take the screenshots through the Stream source






To get the streams, I have the following code thanks to a SO user :


from twitch import TwitchClient

client = TwitchClient(client_id='<my client="client">')
streams = client.streams.get_live_streams(limit=100)

print(streams)
</my>


The output is this. Its a lot larger, I just made it shorter... :


[{'id': 40889579422, 'game': 'Among Us', 'broadcast_platform': 'live', 'community_id': '', 'community_ids': [], 'viewers': 74594, 'video_height': 1080, 'average_fps': 60, 'delay': 0, 'created_at': datetime.datetime(2020, 12, 9, 23, 53, 34), 'is_playlist': False, 'stream_type': 'live', 'preview': {'small': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-80x45.jpg', 'medium': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-320x180.jpg', 'large': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-640x360.jpg', 'template': 'https://static-cdn.jtvnw.net/previews-ttv/live_user_sykkuno-{width}x{height}.jpg'}, 'channel': {'mature': False, 'status': 'amongus at 4 !!', 'broadcaster_language': 'en', 'broadcaster_software': '', 'display_name': 'Sykkuno', 'game': 'Among Us', 'language': 'en', 'id': 26154978, 'name': 'sykkuno', 'created_at': datetime.datetime(2011, 11, 15, 1, 29, 29, 140794), 'updated_at': datetime.datetime(2020, 12, 10, 0, 35, 50, 916363), 'partner': True, 'logo': 'https://static-cdn.jtvnw.net/jtv_user_pictures/sykkuno-profile_image-6ab1e70e07e29e9b-300x300.jpeg', 'video_banner': 'https://static-cdn.jtvnw.net/jtv_user_pictures/4b654ce5-58dc-4fa6-b77c-7250bb2d5269-channel_offline_image-1920x1080.png', 'profile_banner': 'https://static-cdn.jtvnw.net/jtv_user_pictures/1caee146-3323-4d45-9907-96c20c224d3e-profile_banner-480.png', 'profile_banner_background_color': '', 'url': 'https://www.twitch.tv/sykkuno', 'views': 23590965, 'followers': 1928724, 'broadcaster_type': '', 'description': 'Hi ! ', 'private_video': False, 'privacy_options_enabled': False}}, ... 



First, I want to know how I can iterate through the JSON to get the channel name using the
id
. I tried to do it on my own but it said that it isn't subscriptable.

Second, I have the following code that tries to use
ffmpeg
to get a screenshot of the stream through its source :

import streamlink, os

# This code connects to the streamer's source
# Get the Twitch API to work so you can add the streamer's name at the end of the link
username = 'Sykkuno'
streams = streamlink.streams('http://twitch.tv/' + username)

# Stream source
stream = streams["best"].url

# Directory where the screenshots will be saved
dir_path = os.getcwd() + '/' + username

# number of streamers
streamers = 1

os.system('ffmpeg -i ' + stream +' -r 0.5 -f image2 ${dir}/output_%09d.jpg')



But that is throwing the following error :


ffmpeg version 4.1.3-0ppa1~18.04 Copyright (c) 2000-2019 the FFmpeg developers
 built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
 configuration: --prefix=/usr --extra-version='0ppa1~18.04' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-nonfree --enable-libfdk-aac --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
 libavutil 56. 22.100 / 56. 22.100
 libavcodec 58. 35.100 / 58. 35.100
 libavformat 58. 20.100 / 58. 20.100
 libavdevice 58. 5.100 / 58. 5.100
 libavfilter 7. 40.101 / 7. 40.101
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 3.100 / 5. 3.100
 libswresample 3. 3.100 / 3. 3.100
 libpostproc 55. 3.100 / 55. 3.100
[hls,applehttp @ 0x557212854940] Opening 'https://video-edge-c2a360.yto01.abs.hls.ttvnw.net/v1/segment/CuAErHgNDEVK3cqjkRZLcz4El99YD2ZSy9tgtjc3ZTrPuN4584-GY3DKYO3MFCBt9M3v8_7IfHAlLvHeUn2wq4d-VC7u4Zv2-k1Bee9IPmIXbFQLZFKrYiT98OTzFMDaElsEZ9Sr4MXz6FoAC1yXhhZ0MYahZVnZa1Tuqnn217nN_rN8wr7kdScBIir_Uo1s2C_I8_54mi2uzdgxB9AYj0a0kG2UtdPkUVA6Qc7XIZ0nUhEeObEf80N0uW9ZU6WHpO3V6G9RD0VkmwUexDWk9MaLy1NJuvLSzRaMfOmKxhrzn3UDoY4CrQN11KOnHYCiCOfvhZmMKzSqtiA8YP0Q9iS03eZZhPQ3WxBHWhd6VeZ0btNeeoudGX73EBIj4ujZnKWKfPiN8K_HLj5FZWqQ5m_4Q1llQlnSAfmhzXR9PHAkz8nxRVcFR-tFokGzFEfkZGHngPNz9boLmo4KHx6404rocPUcXbTHkYsWXZwFC356AhfrNn6x0JYHGfcDpRsEFebLQljEpCyhnNOHFEf9b7Ipeiy521cCupzoEz1uMrzW77h9FJwn0GwvY3jp2KwRXJMvArYwiUHccBmfW7ZDLO9vH7eJGUnAzoy586KMSPLVeLxWMWRDfKkAcI8vYXOIuxNb_MZKm2O_dcoFrDDta5TZn-MLjFquT47P9NbXxlTTJfimlYyMG17SPoW3KJVtAJmjoj0GZ1ehftLJWz1Qgd8zmg40u4g8fz867eCHW_Tiv65yd6qJZD-_bD3G916fm3KeA9bPyhalTD99CWhQL7f0apCfX_6IiQElgPT6kOrFI-ISEG4GdhIpFi4ubzSx29pm7H4aDIXx6BAI5ziHVMPbrg.ts' for reading
[hls,applehttp @ 0x557212854940] Opening 'https://video-edge-c2a360.yto01.abs.hls.ttvnw.net/v1/segment/CuIECWLarz2I5hNCtGLSTDXbCIgahI91KOHXVmPHddzZediyiVbcicZpGakO99CJp1cK_6OnmOKBzZ3sn3KogNyPVRqSy32IpanlyPPUTz23TojfR5DTmJa3zampOzVMfETvvPEpj58-kGhQeQQGtK1zLV2h465RElCLkmc7SeWbXEZ5j6IQ38OVFZ0vdcMHVTNPtJaY7509bE196-9-5YYFiET_-kdkS2X6_lhVQBZrq45PBxApTzeLkDx9ZtGQx78dLr_tZepww_uVnJTwxI_TA3tU8z5_w8ml6rh0GK1W6lTlvuDkPKAwIDLvG736MtbPGz9cFPoRAFQxD3QSwAM-bO1grvWlNsOUDUYLXLNjuejmz8xmRpeE0pqJYxUboRZpxrPXTi52HcX8lpGT4Lx2z6hJcoi9npQttK58HDSHQ3cYH3rlNsYV_RlZ3F-u-fZSn8Em67-vAYeXAMaBe9xxv0Zu2n1TrdPICMyGmk-VgLK788IeDhxqM441GONGLxo6AF8RE5_OawTf9n_MVzImsX4LMn0oN8e8w6mjk7YDuNdA4mEl99Erg8xMdX6Q3fDYTdStaC-zQwXgMctfGpIsUpp91BtRBPMynFCxZ8fZB7NvGFNZTYWDvCZjisiwzs0N1pDdDM_Fkj3i46_Ou105z348PLHRA28Dt1qgn_NjzwRNoaowFx7PxQ-X2zRpAhwNcqaTOHYh5NYZHToVE16WiOe9HzVs_I_3Wqu44bypEsGrhxYhgXSGfvO757iTbErZHmkidsBF2BET5j3JeIifr4fJooalAKc_5uiSPMCGSTtV9hIQX5mQWJudg9UsMRp1AWVrnBoMQPAhy1UwBDtAOrBs.ts' for reading
Input #0, hls,applehttp, from 'https://video-weaver.yto01.hls.ttvnw.net/v1/playlist/CvADco9ZO_szpL7RVLVI3U6zl4IMo2uaUBvZTWAyEOKETN-SxI3m3hLLxpmCfz06rlyCGCPimEbk28kKPSbVYtMThiZFRtLxnrdpLr5DWBQwbpIStPQwMetU4Z04Mkm3nEWplL8hpn69Cmd_eWSdI1yHubK_sRL-n1ml5akAEWWGkS0OgVRQTTsYv4RpkbeWc8wrr3DsDBDfyrxciGSZevnStZOLwg-tNuNu3VNugLigNG1HMsNdxoJGO6wLyO-6FL5EQidOiSw2THSibAvADAWMVOxNX2z39d-nJwbVprbWFnox_lDlh-y88uhjj_MpU6OwkXP9vgrBDEmKjtRbYsIN5N94-8pDFEB3yIYk10vUiuod1yfqztVCqWo5m9r48uINP1CD-Bwgybo6K7Oko-TUjMj43GqAu0mmPtkgPFO69LpQQMifZTn_XbVQ5UUfoCwyl-ljObfRE51aCvZP_dOTsUyqi_JRE8h-C3306aW1ISXwCs3YpnjDxJv6yKyWTktBvsN5NWMVzJg-_-MAtTmoy-w2ppbbOozLzyrGF4zfCetaHLmHtbsKe1Ed1nndJg9b6T7v-87ExrI0eQwRjH3gmBTgqu_peS5oQGBaDOe4QSGMNFgf8lQfuqvFH-miXgpk8RytdorzT7wB05iX7c3bhBIQ3FvvjNIal3IgvyxKatZs4BoMW_P_CuyZOUJs2_Yr.m3u8':
 Duration: N/A, start: 60.000000, bitrate: N/A
 Program 0 
 Metadata:
 variant_bitrate : 0
 Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
 Metadata:
 variant_bitrate : 0
 Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, unknown/bt709/unknown), 1920x1080, 29.97 tbr, 90k tbn, 2k tbc
 Metadata:
 variant_bitrate : 0
 Stream #0:2: Data: timed_id3 (ID3 / 0x20334449)
 Metadata:
 variant_bitrate : 0
Stream mapping:
 Stream #0:1 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 0x557213e262c0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/output_%09d.jpg':
 Metadata:
 encoder : Lavf58.20.100
 Stream #0:0: Video: mjpeg, yuvj420p(pc), 1920x1080, q=2-31, 200 kb/s, 0.50 fps, 0.50 tbn, 0.50 tbc
 Metadata:
 variant_bitrate : 0
 encoder : Lavc58.35.100 mjpeg
 Side data:
 cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
[image2 @ 0x557213012040] Could not open file : /output_000000001.jpg
av_interleaved_write_frame(): Input/output error
frame= 1 fps=0.0 q=7.5 Lsize=N/A time=00:00:02.00 bitrate=N/A speed=27.7x 
video:46kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Conversion failed!



-
ffmpeg capture video and audio produced corrupt output
18 décembre 2020, par wheelie tipsI have two separate FFmpeg commands that each works well on its own, one for capturing video and the other for capturing audio from the same device ; the captured audio is :


ffmpeg -f alsa -thread_queue_size 16384 -i hw:CARD=C4K,DEV=0 -acodec aac /home/pi/Videos/temp.wav



and the captured video is :


ffmpeg -y -nostdin -f v4l2 -threads auto -input_format yuyv422 -fflags +genpts -flags +global_header -thread_queue_size 16384 -i /dev/video0 -s 1280x720 -r 25 -vcodec h264_v4l2m2m -num_output_buffers 32 -num_capture_buffers 16 -keyint_min 25 -force_key_frames "expr:gte(t,n_forced*1)" -g 50 -b:v 6M -pix_fmt nv12 -f mpegts -muxdelay 0 -muxpreload 0 -movflags +faststart /home/pi/Videos/output.mp4



I’ve tried to combine the two into one call to produce one video file with the audio channel, but whatever I’ve been attempting, the results output were messed up ; obviously, I’m missing something, for example, my latest attempt prodused a frozen image video with the audio channel :


ffmpeg -y -nostdin -f v4l2 -threads auto -input_format yuyv422 -fflags +genpts -flags +global_header -thread_queue_size 16384 -i /dev/video0 -f alsa -thread_queue_size 16384 -i hw:CARD=C4K,DEV=0 -acodec aac -s 1280x720 -r 25 -vcodec h264_v4l2m2m -num_output_buffers 32 -num_capture_buffers 16 -keyint_min 25 -force_key_frames "expr:gte(t,n_forced*1)" -g 50 -b:v 6M -b:a 128K -pix_fmt nv12 -f mpegts -muxdelay 0 -muxpreload 0 -movflags +faststart /home/pi/Videos/output.mp4 -loglevel debug



the full output of the above command :


ffmpeg version ca55240 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 8 (Debian 8.3.0-6)
 configuration: --prefix=/home/pi/ffmpeg_build --pkg-config-flags='pkg-config --static' --extra-cflags=-I/home/pi/ffmpeg_build/include --extra-ldflags=-L/home/pi/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/pi/bin --enable-gpl --enable-gnutls --disable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --disable-libx265 --enable-nonfree --arch=aarch64 --disable-libxml2 --enable-libwebp --enable-libdrm
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Splitting the commandline.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-nostdin' ... matched as option 'stdin' (enable or disable interaction on standard input) with argument 0.
Reading option '-f' ... matched as option 'f' (force format) with argument 'v4l2'.
Reading option '-threads' ... matched as AVOption 'threads' with argument 'auto'.
Reading option '-input_format' ... matched as AVOption 'input_format' with argument 'yuyv422'.
Reading option '-fflags' ... matched as AVOption 'fflags' with argument '+genpts'.
Reading option '-flags' ... matched as AVOption 'flags' with argument '+global_header'.
Reading option '-thread_queue_size' ... matched as option 'thread_queue_size' (set the maximum number of queued packets from the demuxer) with argument '16384'.
Reading option '-i' ... matched as input url with argument '/dev/video0'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.
Reading option '-thread_queue_size' ... matched as option 'thread_queue_size' (set the maximum number of queued packets from the demuxer) with argument '16384'.
Reading option '-i' ... matched as input url with argument 'hw:CARD=C4K,DEV=0'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-s' ... matched as option 's' (set frame size (WxH or abbreviation)) with argument '1280x720'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '25'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_v4l2m2m'.
Reading option '-num_output_buffers' ... matched as AVOption 'num_output_buffers' with argument '32'.
Reading option '-num_capture_buffers' ... matched as AVOption 'num_capture_buffers' with argument '16'.
Reading option '-keyint_min' ... matched as AVOption 'keyint_min' with argument '25'.
Reading option '-force_key_frames' ... matched as option 'force_key_frames' (force key frames at specified timestamps) with argument 'expr:gte(t,n_forced*1)'.
Reading option '-g' ... matched as AVOption 'g' with argument '50'.
Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '6M'.
Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '128K'.
Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'nv12'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'mpegts'.
Reading option '-muxdelay' ... matched as option 'muxdelay' (set the maximum demux-decode delay) with argument '0'.
Reading option '-muxpreload' ... matched as option 'muxpreload' (set the initial demux-decode delay) with argument '0'.
Reading option '-movflags' ... matched as AVOption 'movflags' with argument '+faststart'.
Reading option '/home/pi/Videos/output.mp4' ... matched as output url.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option nostdin (enable or disable interaction on standard input) with argument 0.
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input url /dev/video0.
Applying option f (force format) with argument v4l2.
Applying option thread_queue_size (set the maximum number of queued packets from the demuxer) with argument 16384.
Successfully parsed a group of options.
Opening an input file: /dev/video0.
[video4linux2,v4l2 @ 0x55a0c86b40] fd:3 capabilities:84a00001
[video4linux2,v4l2 @ 0x55a0c86b40] Current input_channel: 0, input_name: Input 1, input_std: 0
[video4linux2,v4l2 @ 0x55a0c86b40] Querying the device for the current frame size
[video4linux2,v4l2 @ 0x55a0c86b40] Setting frame size to 1920x1080
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
[video4linux2,v4l2 @ 0x55a0c86b40] All info found Input #0, video4linux2,v4l2, from '/dev/video0':
 Duration: N/A, start: 0.000000, bitrate: 1988671 kb/s
 Stream #0:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (YUY2 / 0x32595559), yuyv422, 1920x1080, 0/1, 1988671 kb/s, 59.94 fps, 59.94 tbr, 1000k tbn, 1000k tbc Successfully opened the file.
Parsing a group of options: input url hw:CARD=C4K,DEV=0.
Applying option f (force format) with argument alsa.
Applying option thread_queue_size (set the maximum number of queued packets from the demuxer) with argument 16384.
Successfully parsed a group of options.
Opening an input file: hw:CARD=C4K,DEV=0.
[alsa @ 0x55a0c89630] All info found
Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, alsa, from 'hw:CARD=C4K,DEV=0':
 Duration: N/A, start: 1608286705.387903, bitrate: 1536 kb/s
 Stream #1:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Successfully opened the file.
Parsing a group of options: output url /home/pi/Videos/output.mp4.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option s (set frame size (WxH or abbreviation)) with argument 1280x720.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 25.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_v4l2m2m.
Applying option force_key_frames (force key frames at specified timestamps) with argument expr:gte(t,n_forced*1).
Applying option b:v (video bitrate (please use -b:v)) with argument 6M.
Applying option b:a (video bitrate (please use -b:v)) with argument 128K.
Applying option pix_fmt (set pixel format) with argument nv12.
Applying option f (force format) with argument mpegts.
Applying option muxdelay (set the maximum demux-decode delay) with argument 0.
Applying option muxpreload (set the initial demux-decode delay) with argument 0.
Successfully parsed a group of options.
Opening an output file: /home/pi/Videos/output.mp4.
[file @ 0x55a0ca7210] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
Stream mapping:
 Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_v4l2m2m))
 Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native)) 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)
 Last message repeated 3 times
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
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)
 Last message repeated 12 times
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
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)
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
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)
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
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)
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
 Last message repeated 2 times
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)
[video4linux2,v4l2 @ 0x55a0c86b40] Dequeued v4l2 buffer contains corrupted data (0 bytes).
 Last message repeated 23 times
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)
 Last message repeated 1452 times
[rawvideo @ 0x55a0c89130] PACKET SIZE: 4147200, STRIDE: 3840 detected 4 logical cores [graph 0 input from stream 0:0 @ 0x55a0ca9080] Setting 'video_size' to value '1920x1080'
[graph 0 input from stream 0:0 @ 0x55a0ca9080] Setting 'pix_fmt' to value '1'
[graph 0 input from stream 0:0 @ 0x55a0ca9080] Setting 'time_base' to value '1/1000000'
[graph 0 input from stream 0:0 @ 0x55a0ca9080] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x55a0ca9080] Setting 'frame_rate' to value '7013/117'
[graph 0 input from stream 0:0 @ 0x55a0ca9080] w:1920 h:1080 pixfmt:yuyv422 tb:1/1000000 fr:7013/117 sar:0/1
[scaler_out_0_0 @ 0x55a0cb0060] Setting 'w' to value '1280'
[scaler_out_0_0 @ 0x55a0cb0060] Setting 'h' to value '720'
[scaler_out_0_0 @ 0x55a0cb0060] Setting 'flags' to value 'bicubic'
[scaler_out_0_0 @ 0x55a0cb0060] w:1280 h:720 flags:'bicubic' interl:0 [format @ 0x55a0cb05b0] Setting 'pix_fmts' to value 'nv12'
[AVFilterGraph @ 0x55a0ca2730] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[scaler_out_0_0 @ 0x55a0cb0060] w:1920 h:1080 fmt:yuyv422 sar:0/1 -> w:1280 h:720 fmt:nv12 sar:0/1 flags:0x4 [h264_v4l2m2m @ 0x55a0ca5610] probing device /dev/video12 [h264_v4l2m2m @ 0x55a0ca5610] driver 'bcm2835-codec' on card 'bcm2835-codec-isp' in mplane mode [h264_v4l2m2m @ 0x55a0ca5610] v4l2 capture format not supported [h264_v4l2m2m @ 0x55a0ca5610] probing device /dev/video11 [h264_v4l2m2m @ 0x55a0ca5610] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode [h264_v4l2m2m @ 0x55a0ca5610] Using device /dev/video11 [h264_v4l2m2m @ 0x55a0ca5610] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode [h264_v4l2m2m @ 0x55a0ca5610] requesting formats: output=NV12 capture=H264 [h264_v4l2m2m @ 0x55a0ca5610] output: NV12 32 buffers initialized: 1280x0720, sizeimage 01382400, bytesperline 00001280 [h264_v4l2m2m @ 0x55a0ca5610] capture: H264 16 buffers initialized: 1280x0720, sizeimage 00524288, bytesperline 00000000 [h264_v4l2m2m @ 0x55a0ca5610] Failed to set number of B-frames: Invalid argument [h264_v4l2m2m @ 0x55a0ca5610] Failed to get number of B-frames [h264_v4l2m2m @ 0x55a0ca5610] Failed to set header mode: Invalid argument [h264_v4l2m2m @ 0x55a0ca5610] Encoder: bit rate = 6000000 [h264_v4l2m2m @ 0x55a0ca5610] Failed to set frame level rate control: Invalid argument [h264_v4l2m2m @ 0x55a0ca5610] Failed to set gop size: Invalid argument [h264_v4l2m2m @ 0x55a0ca5610] Encoder: repeat parameter sets = 1 [h264_v4l2m2m @ 0x55a0ca5610] Encoder Context: id (27), profile (-99), frame rate(25/1), number b-frames (0), gop size (50), bit rate (6000000), qmin (-1), qmax (-1) [h264_v4l2m2m @ 0x55a0ca5610] Failed to set minimum video quantizer scale: Invalid argument [h264_v4l2m2m @ 0x55a0ca5610] Failed to set maximum video quantizer scale: Invalid argument Forced keyframe at time 0.000000 [h264_v4l2m2m @ 0x55a0ca5610] Encoder: force key frame = 0 cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) cur_dts is invalid st:1 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[graph_1_in_1_0 @ 0x55a0d465d0] Setting 'time_base' to value '1/48000'
[graph_1_in_1_0 @ 0x55a0d465d0] Setting 'sample_rate' to value '48000'
[graph_1_in_1_0 @ 0x55a0d465d0] Setting 'sample_fmt' to value 's16'
[graph_1_in_1_0 @ 0x55a0d465d0] Setting 'channel_layout' to value '0x3'
[graph_1_in_1_0 @ 0x55a0d465d0] tb:1/48000 samplefmt:s16 samplerate:48000 chlayout:0x3
[format_out_0_1 @ 0x55a0d46af0] Setting 'sample_fmts' to value 'fltp'
[format_out_0_1 @ 0x55a0d46af0] Setting 'sample_rates' to value '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
[format_out_0_1 @ 0x55a0d46af0] auto-inserting filter 'auto_resampler_0' between the filter 'Parsed_anull_0' and the filter 'format_out_0_1'
[AVFilterGraph @ 0x55a0d45c10] query_formats: 4 queried, 6 merged, 3 already done, 0 delayed
[auto_resampler_0 @ 0x55a0d47740] [SWR @ 0x55a0d47890] Using s16p internally between filters
[auto_resampler_0 @ 0x55a0d47740] ch:2 chl:stereo fmt:s16 r:48000Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz [mpegts @ 0x55a0caec00] service 1 using PCR in pid=256, pcr_period=80ms [mpegts @ 0x55a0caec00] muxrate VBR, sdt every 500 ms, pat/pmt every 100 ms Output #0, mpegts, to '/home/pi/Videos/output.mp4':
 Metadata:
 encoder : Lavf58.45.100
 Stream #0:0, 0, 1/90000: Video: h264 (h264_v4l2m2m), 1 reference frame, nv12(progressive), 1280x720, 0/1, q=-1--1, 6000 kb/s, 25 fps, 90k tbn, 25 tbc
 Metadata:
 encoder : Lavc58.91.100 h264_v4l2m2m
 Stream #0:1, 0, 1/90000: Audio: aac (LC), 48000 Hz, stereo, fltp, delay 1024, 128 kb/s
 Metadata:
 encoder : Lavc58.91.100 aac
cur_dts is invalid st:0 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream) [rawvideo @ 0x55a0c89130] PACKET SIZE: 4147200, STRIDE: 3840 Clipping frame in rate conversion by 0.132942 cur_dts is invalid st:1 (0) [init:1 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
 Last message repeated 17 times
^Cframe= 2 fps=0.3 q=-0.0 Lsize= 183kB time=00:21:16.64 bitrate= 1.2kbits/s speed= 189x
video:24kB audio:101kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 46.992252% Input file #0 (/dev/video0):
 Input stream #0:0 (video): 34 packets read (8294400 bytes); 2 frames decoded;
 Total: 34 packets (8294400 bytes) demuxed Input file #1 (hw:CARD=C4K,DEV=0):
 Input stream #1:0 (audio): 2712 packets read (1233148 bytes); 2712 frames decoded (308287 samples);
 Total: 2712 packets (1233148 bytes) demuxed Output file #0 (/home/pi/Videos/output.mp4):
 Output stream #0:0 (video): 2 frames encoded; 2 packets muxed (24588 bytes);
 Output stream #0:1 (audio): 301 frames encoded (308224 samples); 302 packets muxed (103182 bytes);
 Total: 304 packets (127770 bytes) muxed
2714 frames successfully decoded, 0 decoding errors [AVIOContext @ 0x55a0ca7100] Statistics: 0 seeks, 1 writeouts [aac @ 0x55a0ca65e0] Qavg: 165.061 Exiting normally, received signal 2.



can anyone please help me figure this out ?


Thanks much !


RS


-
ffmpeg export without color loss
27 décembre 2020, par serI'm trying to add a watermark to a video through ffmpeg, but all the exports result in loss of color information. I would like to retain the same color information as the original video, how do I do that ?


Currently, I use this code :


./ffmpeg -i input.MOV -loop 1 -i logo.png -codec:v libx264 -crf 18 -preset medium -filter_complex "



I realised the only way to not lose the color information is to set -crf to 0 and -preset to veryslow, but it results in a really large file size. (2 times the size of original video, which is not effective)


I also get this error when I run ffpmeg :


[swscaler @ 0x117577000] deprecated pixel format used, make sure you did set range correctly



See Image comparison here — the blacks on the export were not as "black" as original


ffprobe -show_streams for Original File


ffprobe version 4.3.1-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2007-2020 the FFmpeg developers
 built with Apple clang version 11.0.0 (clang-1100.0.33.17)
 configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0930-BenjaminWong.mov':
 Metadata:
 major_brand : qt 
 minor_version : 0
 compatible_brands: qt 
 creation_time : 2020-12-22T11:31:49.000000Z
 Duration: 00:00:30.00, start: 0.000000, bitrate: 14688 kb/s
 Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 252 kb/s (default)
 Metadata:
 creation_time : 2020-12-22T11:31:49.000000Z
 handler_name : Core Media Audio
 Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1080x1920, 14430 kb/s, 30 fps, 30 tbr, 600 tbn, 1200 tbc (default)
 Metadata:
 creation_time : 2020-12-22T11:31:49.000000Z
 handler_name : Core Media Video
 encoder : H.264
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=1321751
duration=29.971678
bit_rate=252820
max_bit_rate=256000
bits_per_raw_sample=N/A
nb_frames=1293
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-12-22T11:31:49.000000Z
TAG:language=und
TAG:handler_name=Core Media Audio
[/STREAM]
[STREAM]
index=1
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/60
codec_tag_string=avc1
codec_tag=0x31637661
width=1080
height=1920
coded_width=1088
coded_height=1920
closed_captions=0
has_b_frames=1
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuvj420p
level=40
color_range=pc
color_space=bt709
color_transfer=bt709
color_primaries=bt709
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30/1
avg_frame_rate=30/1
time_base=1/600
start_pts=0
start_time=0.000000
duration_ts=18000
duration=30.000000
bit_rate=14430480
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=900
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:creation_time=2020-12-22T11:31:49.000000Z
TAG:language=und
TAG:handler_name=Core Media Video
TAG:encoder=H.264
[/STREAM]



ffprobe -show_streams for Exported File (added filter & watermark)


ffprobe version 4.3.1-tessus https://evermeet.cx/ffmpeg/ Copyright (c) 2007-2020 the FFmpeg developers
 built with Apple clang version 11.0.0 (clang-1100.0.33.17)
 configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvmaf --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
 libavutil 56. 51.100 / 56. 51.100
 libavcodec 58. 91.100 / 58. 91.100
 libavformat 58. 45.100 / 58. 45.100
 libavdevice 58. 10.100 / 58. 10.100
 libavfilter 7. 85.100 / 7. 85.100
 libswscale 5. 7.100 / 5. 7.100
 libswresample 3. 7.100 / 3. 7.100
 libpostproc 55. 7.100 / 55. 7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'IMG_0930-BenjaminWong_watermarked_1080h264-5.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.45.100
 Duration: 00:00:30.00, start: 0.000000, bitrate: 5141 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc), 1080x1080, 5003 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
 Metadata:
 handler_name : VideoHandler
 Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 handler_name : Core Media Audio
[STREAM]
index=0
codec_name=h264
codec_long_name=H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
profile=High
codec_type=video
codec_time_base=1/60
codec_tag_string=avc1
codec_tag=0x31637661
width=1080
height=1080
coded_width=1088
coded_height=1088
closed_captions=0
has_b_frames=2
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuvj420p
level=32
color_range=pc
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=unknown
timecode=N/A
refs=1
is_avc=true
nal_length_size=4
id=N/A
r_frame_rate=30/1
avg_frame_rate=30/1
time_base=1/15360
start_pts=0
start_time=0.000000
duration_ts=460800
duration=30.000000
bit_rate=5003599
max_bit_rate=N/A
bits_per_raw_sample=8
nb_frames=900
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=VideoHandler
[/STREAM]
[STREAM]
index=1
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=mp4a
codec_tag=0x6134706d
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/44100
start_pts=0
start_time=0.000000
duration_ts=1321898
duration=29.975011
bit_rate=128780
max_bit_rate=128780
bits_per_raw_sample=N/A
nb_frames=1292
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=1
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:language=und
TAG:handler_name=Core Media Audio
[/STREAM]