Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP

Autres articles (66)

Sur d’autres sites (13735)

  • ffmpeg : recode transport stream (MPEG2 or h264) to another transport stream (h264)

    14 juin 2017, par MatMike

    currently, I’m struggling with a task I want to implement using a perl script on a Synology DiskStation.
    What I’m not sure about is the ffmpeg command to use.
    Actually, the DiskStation supports hardware encoding and it works quite well encoding to MKV files. The only thing that’s missing : I don’t want to encode to MKV as it’s hard to work on these files with my other software for cutting.
    Therefore, I’d like to encode to a transport stream again.
    I’m using this command at the moment :

    sudo ffmpeg -hide_banner -loglevel verbose -vaapi_device /dev/dri/renderD128 -i my_input_file.ts -map 0:v -map 0:a -c:v h264_vaapi -vf yadif,format=nv12,hwupload -y -b:v my_bitrate my_output_file.ts

    Now, I always get an error :

    Automatic encoder selection failed for output stream #0:1. Default encoder for format mpegts (codec mp2) is probably disabled. Please choose an encoder manually.
    Error selecting an encoder for stream 0:1

    To me it looks like it’s not recognizing that I want to encode using h264 and not the default encoder for transport streams.

    Any ideas on this ?

    Explanation :

    • The mapping is done to get rid of non-supported streams such as teletext and also reduce some streams as I get more than one language stream normally.
    • The sudo is needed as only root is allowed to use vaapi device on Synology (maybe on all systems)

    It would be great if someone could give me a helping hand on this.

    Thanks,
    Matthias

  • Revision e890c2579b : add a context tree structure to encoder This patch sets up a quad_tree structur

    17 avril 2014, par Jim Bankoski

    Changed Paths :
     Modify /vp9/encoder/vp9_block.h


     Add /vp9/encoder/vp9_context_tree.c


     Add /vp9/encoder/vp9_context_tree.h


     Modify /vp9/encoder/vp9_encodeframe.c


     Modify /vp9/encoder/vp9_firstpass.c


     Modify /vp9/encoder/vp9_onyx_if.c


     Modify /vp9/vp9cx.mk



    add a context tree structure to encoder

    This patch sets up a quad_tree structure (pc_tree) for holding all of
    pick_mode_context data we use at any square block size during encoding
    or picking modes. That includes contexts for 2 horizontal and 2 vertical
    splits, one none, and pointers to 4 sub pc_tree nodes corresponding
    to split. It also includes a pointer to the current chosen partitioning.

    This replaces code that held an index for every level in the pick
    modes array including : sb_index, mb_index,
    b_index, ab_index.

    These were used as stateful indexes that pointed to the current pick mode
    contexts you had at each level stored in the following arrays

    array ab4x4_context[][][],
    sb8x4_context[][][], sb4x8_context[][][], sb8x8_context[][][],
    sb8x16_context[][][], sb16x8_context[][][], mb_context[][], sb32x16[][],
    sb16x32[], sb32_context[], sb32x64_context[], sb64x32_context[],
    sb64_context

    and the partitioning that had been stored in the following :
    b_partitioning, mb_partitioning, sb_partitioning, and sb64_partitioning.

    Prior to this patch before doing an encode you had to set the appropriate
    index for your block size ( switch statement), update it ( up to 3
    lookups for the index array value) and then make your call into a recursive
    function at which point you'd have to call get_context which then
    had to do a switch statement based on the blocksize, and then up to 3
    lookups based upon the block size to find the context to use.

    With the new code the context for the block size is passed around directly
    avoiding the extraneous switch statements and multi dimensional array
    look ups that were listed above. At any level in the search all of the
    contexts are local to the pc_tree you are working on (in ?).

    In addition in most places code that used to call sub functions and
    then check if the block size was 4x4 and index was > 0 and return
    now don't preferring instead to call the right none function on the inside.

    Change-Id : I06e39318269d9af2ce37961b3f95e181b57f5ed9

  • Reduce RTMP buffer while decoding using ffmpeg

    15 janvier 2019, par Alberto Padilla

    I’m setting up a new server using nginx and nginx-rtmp-module. I installed a DeckLink Duo2 card to output SDI signals comming from the RTMP stream.

    Everything works really great using this simple nginx.conf configuration :

    rtmp {
       server {
               listen 1935;
               chunk_size 4096;

               wait_video on;
               wait_key on;

               sync 10ms;

               application live {
                   live on;
                   record off;

                   exec_push /home/myuser/bin/ffmpeg -i rtmp://127.0.0.1/live/mystreamname -f decklink -format_code pal -pix_fmt uyvy422 'DeckLink Duo (1)';
               }  
      }
    }

    My goal is to achieve the absolute minimum delay between the received stream and the SDI output.

    I can achieve 3 seconds "waving hand" delay using the configuration that I mentioned. However, using ffplay I observe 1.5s delay using the -fflags nobuffer option.

    As ffplay cannot output to a decklink device, I want ffmpeg to reduce the buffer to the minimum, but I can’t find the way to do it. All the -rtmp_buffer or -fflag nobuffer or any other options have no impact on the delay.

    The stream is being received in the same machine ffmpeg is running, that is why it makes sense to reduce the ffmpeg buffering to the minimum if I want to achieve low delay.

    Any tips ?