Recherche avancée

Médias (1)

Mot : - Tags -/epub

Autres articles (12)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (2604)

  • ffmpeg 4 : Using the stream_loop parameter to loop the audio during a video ends up with an infinite loop

    17 juin 2020, par JarsOfJam-Scheduler

    Summary

    



      

    1. Context
    2. 


    3. The software I use
    4. 


    5. The problem
    6. 


    7. Results
      
4.1. Actual Results

      



      4.2. Expected Results

    8. 


    9. What did I try to fix the bug ?

    10. 


    11. How to reproduce this bug : minimal and testable example with the provided required data

    12. 


    13. The question

    14. 


    15. Sources

    16. 


    




    



    Context

    



    I would want to set an audio WAV as the background sound of a video WEBM. The video can be shorter or longer than the audio. At the moment I add the audio over the video, I don't know the length of both streams. The audio must repeat until the video ends (the audio can be truncated if the video ends before the end of the last repetition of the audio).

    



    The software I use

    



    I use ffmpeg version 4.2.2-1ubuntu1 18.04.sav0.

    



    The problem

    



    ffmpeg seems to enter in an infinite loop when it proccesses in order to mix the audio and the video. Also, the length of the currently-generating-output-file (which contains both video and audio) is equal to the length of the audio, instead of the length of the video.

    



    The problem seems to be triggered by this command line :

    



    ffmpeg -i directory_1/video.webm -stream_loop -1 -fflags +shortest -max_interleave_delta 50000 -i directory_2/audio.wav directory_3/video_and_audio.webm


    



    Results

    



    Actual Results

    



    Three things :

    



      

    1. The infinite loop of the ffmpeg process : I must manually stop the ffmpeg process

    2. 


    3. The output video file with music (which is currently generating but output anyway) : it contains both audio and video. But the length of the output file is equal to the length of the audio, instead of the length of the video.

    4. 


    5. The following output logs :

    6. 


    



    


    ffmpeg version 4.2.2-1ubuntu1 18.04.sav0 Copyright (c) 2000-2019 the
 FFmpeg developers built with gcc 7 (Ubuntu 7.5.0-3ubuntu1 18.04)
    
 configuration : —prefix=/usr —extra-version='1ubuntu1 18.04.sav0'
 —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-opencl —enable-opengl —enable-sdl2 —enable-libdc1394 —enable-libdrm —enable-libiec61883 —enable-nvenc —enable-chromaprint —enable-frei0r —enable-libx264 —enable-shared libavutil 56. 31.100 / 56. 31.100 libavcodec 58. 54.100 / 58. 54.100 libavformat 58. 29.100 / 58. 29.100 libavdevice 58. 8.100 /
 58. 8.100 libavfilter 7. 57.100 / 7. 57.100 libavresample 4. 0. 0 / 4. 0. 0 libswscale 5. 5.100 / 5. 5.100 libswresample 3. 5.100 / 3. 5.100 libpostproc 55. 5.100 /
 55. 5.100 Input #0, matroska,webm, from 'youtubed/my_youtube_video.webm' : Metadata :
 encoder : Chrome Duration : N/A, start : 0.000000, bitrate : N/A
 Stream #0:0(eng) : Video : vp8, yuv420p(progressive), 3200x1608, SAR 1:1 DAR 400:201, 1k tbr, 1k tbn, 1k tbc (default)
 Metadata :
 alpha_mode : 1 Guessed Channel Layout for Input Stream #1.0 : stereo Input #1, wav, from 'tmp_music/original_music.wav' :
    
 Duration : 00:00:11.78, bitrate : 1411 kb/s
 Stream #1:0 : Audio : pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s Stream mapping : Stream #0:0 -> #0:0 (vp8
 (native) -> vp9 (libvpx-vp9)) Stream #1:0 -> #0:1 (pcm_s16le
 (native) -> opus (libopus)) Press [q] to stop, [?] for help
 [libvpx-vp9 @ 0x5645268aed80] v1.8.2 [libopus @ 0x5645268b09c0] No bit
 rate set. Defaulting to 96000 bps. Output #0, webm, to
 'youtubed/my_youtube_video_with_music.webm' : Metadata :
 encoder : Lavf58.29.100
 Stream #0:0(eng) : Video : vp9 (libvpx-vp9), yuv420p(progressive), 3200x1608 [SAR 1:1 DAR 400:201], q=-1—1, 200 kb/s, 1k fps, 1k tbn, 1k
 tbc (default)
 Metadata :
 alpha_mode : 1
 encoder : Lavc58.54.100 libvpx-vp9
 Side data :
 cpb : bitrate max/min/avg : 0/0/0 buffer size : 0 vbv_delay : -1
 Stream #0:1 : Audio : opus (libopus), 48000 Hz, stereo, s16, 96 kb/s
 Metadata :
 encoder : Lavc58.54.100 libopus

    


    



    Expected Results

    



      

    1. No infinite loop during the ffmpeg process

    2. 


    3. Concerning the output logs, I don't know what it should look.

    4. 


    5. The output file with the audio and the video should :

      



      3.1. If the video is longer than the audio, then the audio is repeated until it exactly fits the video. The audio can be truncated.

      



      3.2. If the video is shorter than the audio, then the audio is truncated and exactly fits the video.

      



      3.3. If both video and audio are of the same length, then the audio exactly fits the video.

    6. 


    



    How to reproduce this bug ? (+ required data)

    



      

    1. Download the following files (resp. audio and video) (I must refresh these download links every 24 hours) :

      



      1.1. https://a.uguu.se/dmgsmItjJMDq_audio.wav

      



      1.2. https://a.uguu.se/w3qHDlGq6mOW_video.webm

    2. 


    3. Move them into the directory/directories of your choice.

    4. 


    5. Open your CLI, move to the adequat directory and copy/paste/execute the instruction given in Part. The Problem (don't forget to eventually modify this instruction by indicating the adequat directories, according to step 2.).

    6. 


    7. You'll face my problem.

    8. 


    



    What did I try to fix the bug ?

    



    Nothing, since I don't even understand why the bug occures.

    



    The question

    



    How to correct my command in order to mix these audio and video streams without any infinite loop during the ffmpeg process, keeping in mind that I don't know their length, and that audio must be repeated in order to fit the video, even if audio must be truncated (in the case of the last repetition of the audio file must be truncated because the video stream has just ended) ?

    



    Sources

    



    The source is the command line you can find in Part. The problem.

    


  • Salty Game Music

    31 mai 2011, par Multimedia Mike — General

    Have you heard of Google’s Native Client (NaCl) project ? Probably not. Basically, it allows native code modules to run inside a browser (where ‘browser’ is defined pretty narrowly as ‘Google Chrome’ in this case). Programs are sandboxed so they aren’t a security menace (or so the whitepapers claim) but are allowed to access a variety of APIs including video and audio. The latter API is significant because sound tends to be forgotten in all the hullabaloo surrounding non-Flash web technologies. At any rate, enjoy NaCl while you can because I suspect it won’t be around much longer.

    After my recent work upgrading some old music synthesis programs to user more modern audio APIs, I got the idea to try porting the same code to run under NaCl in Chrome (first Nosefart, then Game Music Emu/GME). In this exercise, I met with very limited success. This blog post documents some of the pitfalls in my excursion.



    Infrastructure
    People who know me know that I’m rather partial — to put it gently — to straight-up C vs. C++. The NaCl SDK is heavily skewed towards C++. However, it does provide a Python tool called init_project.py which can create the skeleton of a project and can do so in C with the '-c' option :

    ./init_project.py -c -n saltynosefart
    

    This generates something that can be built using a simple ‘make’. When I added Nosefart’s C files, I learned that the project Makefile has places for project-necessary CFLAGS but does not honor them. The problem is that the generated Makefile includes a broader system Makefile that overrides the CFLAGS in the project Makefile. Going into the system Makefile and changing "CFLAGS =" -> "CFLAGS +=" solves this problem.

    Still, maybe I’m the first person to attempt building something in Native Client so I’m the first person to notice this ?

    Basic Playback
    At least the process to create an audio-enabled NaCl app is well-documented. Too bad it doesn’t seem to compile as advertised. According to my notes on the matter, I filled in PPP_InitializeModule() with the appropriate boilerplate as outlined in the docs but got a linker error concerning get_browser_interface().

    Plan B : C++
    Obviously, the straight C stuff is very much a second-class citizen in this NaCl setup. Fortunately, there is already that fully functional tone generator example program in the limited samples suite. Plan B is to copy that project and edit it until it accepts Nosefart/GME audio instead of a sine wave.

    The build system assumes all C++ files should have .cc extensions. I have to make some fixes so that it will accept .cpp files (either that, or rename all .cpp to .cc, but that’s not very clean).

    Making Noise
    You’ll be happy to know that I did successfully swap out the tone generator for either Nosefart or GME. Nosefart has a slightly fickle API that requires revving the emulator frame by frame and generating a certain number of audio samples. GME’s API is much easier to work with in this situation — just tell it how many samples it needs to generate and give it a pointer to a buffer. I played NES and SNES music play through this ad-hoc browser plugin, and I’m confident all the other supported formats would have worked if I went through the bother of converting the music data files into C headers to be included in the NaCl executable binaries (dynamically loading data via the network promised to be a far more challenging prospect reserved for phase 3 of the project).

    Portable ?
    I wouldn’t say so. I developed it on Linux and things ran fine there. I tried to run the same binaries on the Windows version of Chrome to no avail. It looks like it wasn’t even loading the .nexe files (NaCl executables).

    Thinking About The (Lack Of A) Future
    As I was working on this project, I noticed that the online NaCl documentation materialized explicit banners warning that my NaCl binaries compiled for Chrome 11 won’t work for Chrome 12 and that I need to code to the newly-released 0.3 SDK version. Not a fuzzy feeling. I also don’t feel good that I’m working from examples using bleeding edge APIs that feature deprecation as part of their naming convention, e.g., pp::deprecated::ScriptableObject().

    Ever-changing API + minimal API documentation + API that only works in one browser brand + requiring end user to explicitly enable feature = … well, that’s why I didn’t bother to release any showcase pertaining to this little experiment. Would have been neat, but I strongly suspect that this is yet another one of those APIs that Google decides to deprecate soon.

    See Also :

  • FFmpeg with Nvidia GPU - full HW transcode with 50i to 50p deinterlacing

    5 janvier 2018, par Jernej Stopinšek

    I’m trying to do a full hardware transcode of an udp stream to hls
    with 50i to 50p deinterlacing.

    I’m using ffmpeg and Nvidia GPU.

    Since HLS requires deinterlacing

    https://developer.apple.com/library/content/documentation/General/Reference/HLSAuthoringSpec/Requirements.html

    I would like to deinterlace an interlaced source stream and preserve
    as much smooth motion and picture quality as possible.

    My hardware, software and driver info :

    GPU : Tesla P100-PCIE-12GB
    Nvidia Driver Version : 387.26
    Cuda compilation tools, release 9.1, V9.1.85
    FFmpeg from git on 20171218

    ffmpeg version N-89520-g3f88744067 Copyright (c) 2000-2017 the FFmpeg
    developers built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
    configuration : —enable-gpl
    —enable-cuda-sdk —enable-libx264 —enable-libx265 —enable-nonfree —enable-libnpp —enable-opengl —enable-opencl —enable-libfreetype —enable-openssl —enable-libzvbi —enable-libfontconfig —enable-libfreetype —enable-libfribidi —extra-cflags=-I/usr/local/cuda/include —extra-ldflags=-L/usr/local/cuda/lib64 —arch=x86_64

    libavutil 56. 6.100 / 56. 6.100
    libavcodec 58. 8.100 / 58.
    8.100
    libavformat 58. 3.100 / 58. 3.100
    libavdevice 58. 0.100 / 58. 0.100
    libavfilter 7. 7.100 / 7. 7.100
    libswscale 5.
    0.101 / 5. 0.101
    libswresample 3. 0.101 / 3. 0.101
    libpostproc 55. 0.100 / 55. 0.100

    Input stream info :

    ffmpeg -t 00:05:00 -i udp://xxx.xxx.xxx.xxx:xxxx -map 0:0 -vf idet -c rawvideo -y -f rawvideo /dev/null

    Input #0, mpegts, from ’udp ://xxx.xxx.xxx.xxx:xxxx’ :
    Duration :
    N/A, start : 49634.159411, bitrate : N/A
    Program xxxxx
    Metadata : service_name :
    service_provider : Stream
    #0:0[0x44d] : Video : h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 50 tbr, 90k
    tbn, 50 tbc
    Stream #0:10x19de : Audio : mp2 ([3][0][0][0] /
    0x0003), 48000 Hz, stereo, s16p, 192 kb/s
    Stream
    #0:20x19e1 : Subtitle : dvb_subtitle ([6][0][0][0] / 0x0006)

    Output #0, rawvideo, to ’/dev/null’ :
    Metadata :
    encoder :
    Lavf58.3.100
    Stream #0:0 : Video : rawvideo (I420 / 0x30323449),
    yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 622080 kb/s, 25 fps, 25
    tbn, 25 tbc
    Metadata :
    encoder : Lavc58.8.100 rawvideo
    frame= 7538 fps= 25 q=-0.0 Lsize=22896675kB time=00:05:01.52
    bitrate=622080.0kbits/s dup=38 drop=0 speed=1.02x
    video:22896675kB audio:0kB subtitle:0kB other streams:0kB global
    headers:0kB muxing overhead : 0.000000%
    [Parsed_idet_0 @
    0x56370b3c5080] Repeated Fields : Neither : 7458 Top : 24 Bottom : 18
    [Parsed_idet_0 @ 0x56370b3c5080] Single frame detection : TFF : 281 BFF :
    13 Progressive : 5639 Undetermined : 1567
    [Parsed_idet_0 @
    0x56370b3c5080] Multi frame detection : TFF : 380 BFF : 0 Progressive :
    7120 Undetermined : 0


    This is my command for adaptive hardware deinterlacing. It gives great results with picture, but sound is out of sync.

    ffmpeg -y -err_detect ignore_err -loglevel debug -vsync -1 -hwaccel cuvid -hwaccel_device 1 -c:v h264_cuvid -deint adaptive -r:v 50 -gpu:v 1 -i "udp://xxx.xxx.xxx.xxx:xxxx=?overrun_nonfatal=1&fifo_size=84450&buffer_size=33554432" -map 0:0 -map 0:1 -c:a aac -b:a 196k -c:v h264_nvenc -flags -global_header+cgop -gpu:v 1 -g:v 50 -bf:v 4 -coder:v cabac -b_adapt:v false -b:v 5184000 -minrate:v 5184000 -maxrate:v 5184000 -bufsize:v 2488320 -rc:v cbr_hq -2pass:v true -rc-lookahead:v 25 -no-scenecut:v 1 -profile:v high -preset:v slow -color_range:v 1 -color_trc:v 1 -color_primaries:v 1 -colorspace:v 1 -f hls -hls_time 5 -hls_list_size 3 -start_number 0 -hls_flags delete_segments /srv/hls/program_01/1080p/index.m3u8

    If I add option "-drop_second_field 1" to h264_cuvid and remove -r:v 50 from input and put it to h264_nvenc - then transcoded stream has synced audio, but I think I’m losing quality due to drop_second_field option.

    ffmpeg -y -err_detect ignore_err -loglevel debug -vsync -1 -hwaccel cuvid -hwaccel_device 1 -c:v h264_cuvid -deint adaptive -drop_second_field 1 -gpu:v 1 -i "udp://xxx.xxx.xxx.xxx:xxxx=?overrun_nonfatal=1&fifo_size=84450&buffer_size=33554432" -map 0:0 -map 0:1 -c:a aac -b:a 196k -c:v h264_nvenc -flags -global_header+cgop -gpu:v 1 -g:v 50 -r:v 50 -bf:v 4 -coder:v cabac -b_adapt:v false -b:v 5184000 -minrate:v 5184000 -maxrate:v 5184000 -bufsize:v 2488320 -rc:v cbr_hq -2pass:v true -rc-lookahead:v 25 -no-scenecut:v 1 -profile:v high -preset:v slow -color_range:v 1 -color_trc:v 1 -color_primaries:v 1 -colorspace:v 1 -f hls -hls_time 5 -hls_list_size 3 -start_number 0 -hls_flags delete_segments /srv/hls/program_01/1080p/index.m3u8

    Could someone please point me in the right direction how to properly deinterlace with cuvid and minimal possible loss of quality ?