Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (66)

Sur d’autres sites (13735)

  • ffmpeg send video to ffserver without reencode, CPU usage still very high.How ?

    3 septembre 2019, par Wayne Chen

    I’m using ffmpeg to send H.264 video to ffserver. Command looks like this :

    ffmpeg -re -stream_loop -1 -i test.mp4 -c copy http://localhost:8090/feed1.ffm

    I thought with -c copy option, the CPU usage of ffmpeg should be very low, but it actually used 99% of CPU.Please help cutdown the usage of CPU.
    Thanks

    ----------------------

    ffserver.conf :

    <feed>
    File /tmp/feed1.ffm
    FileMaxSize 5M
    ACL allow 127.0.0.1
    ACL allow 192.168.1.250
    </feed>

    <stream>
    Feed feed1.ffm
    Format rtp
    VideoCodec libx264
    VideoFrameRate 25
    VideoBufferSize 80000
    VideoSize 1920x1080
    PreRoll 15
    NoDefaults
    NoAudio
    </stream>

    ffserver log:

    ffserver -d -f /etc/ffserver.conf
    ffserver version 3.3.9 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
     configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-version3 --enable-ffplay --enable-ffserver --enable-shared
     libavutil      55. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    Tue Sep  3 09:45:38 2019 Codecs do not match for stream 0
    Tue Sep  3 09:45:38 2019 [ffm @ 0x1072d80]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Tue Sep  3 09:45:38 2019 Codecs do not match for stream 0
    Tue Sep  3 09:45:38 2019 [ffm @ 0x10695e0]Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Tue Sep  3 09:45:38 2019 FFserver started.
    Tue Sep  3 09:45:39 2019 192.168.1.240 - - [] " " 200 0
    Tue Sep  3 09:45:39 2019 192.168.1.240 - - [] " " 200 0
    Tue Sep  3 09:45:39 2019 192.168.1.240:0 - - "PLAY test2-rtsp/streamid=0 RTP/TCP"
    Tue Sep  3 09:45:39 2019 192.168.1.240:0 - - "PLAY test1-rtsp/streamid=0 RTP/TCP"
    Tue Sep  3 09:45:39 2019 192.168.1.240:0 - - "PLAY test2-rtsp/streamid=0 RTP/TCP"
    Tue Sep  3 09:45:39 2019 192.168.1.240:0 - - "PLAY test1-rtsp/streamid=0 RTP/TCP"

    FFmpeg log:

    wayne@ubuntu:~$ ffmpeg -re -stream_loop -1 -i test_main.mp4 -c copy http://localhost:8090/feed1.ffm &amp; ffmpeg -re -stream_loop -1 -i test_minor.mp4
    4 -c copy http://localsudffmpeg -re -stream_loop -1 -i test_main.mp4 -c copy http://localhost:8090/feed1.ffm &amp; ffmpm
    ffmpeg version 3.3.9 Copyright (c) 2000-2018 the FFmpeg developers
     built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.11) 20160609
     configuration: --enable-gpl --enable-nonfree --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-version3 --enable-ffplay --enable-ffserver --enable-shared
     libavutil      55. 58.100 / 55. 58.100
     libavcodec     57. 89.100 / 57. 89.100
     libavformat    57. 71.100 / 57. 71.100
     libavdevice    57.  6.100 / 57.  6.100
     libavfilter     6. 82.100 /  6. 82.100
     libswscale      4.  6.100 /  4.  6.100
     libswresample   2.  7.100 /  2.  7.100
     libpostproc    54.  5.100 / 54.  5.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_main.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.40.101
     Duration: 00:00:51.60, start: 0.000000, bitrate: 987 kb/s
       Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 985 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    [tcp @ 0x19ca600] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
    [tcp @ 0x19d58a0] Connection to tcp://localhost:8090 failed (Connection refused), trying next address
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    [libx264 @ 0x19d67c0] VBV bufsize set but maxrate unspecified, ignored
    [libx264 @ 0x19d67c0] using SAR=1/1
    [libx264 @ 0x19d67c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x19d67c0] profile Progressive High, level 4.0, 4:2:0, 8-bit
    Output #0, ffm, to 'http://localhost:8090/feed1.ffm':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       creation_time   : now
       encoder         : Lavf57.71.100
       Stream #0:0(eng): Video: h264 (libx264), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 1000k tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc57.89.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 655360000 vbv_delay: -1
    frame=   13 fps=0.0 q=0.0 size=       4kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   26 fps= 26 q=0.0 size=       4kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   38 fps= 25 q=0.0 size=       4kB time=00:00:00.00 bitrate=N/A speed=   0x    
    frame=   43 fps= 18 q=28.0 size=       4kB time=-00:00:00.03 bitrate=N/A speed=N/A    
    frame=   55 fps= 19 q=28.0 size=      16kB time=00:00:00.44 bitrate= 297.9kbits/s speed=0.151x    
    frame=   59 fps= 17 q=28.0 size=      44kB time=00:00:00.60 bitrate= 600.7kbits/s speed=0.171x  
  • ffmpeg convert from H.264 (High 4:4:4 Profile) to H.264 (Main Profile)

    15 novembre 2019, par Milad

    How can I convert a video from H.264 (High 4:4:4 Profile) to H.264 (Main Profile) using ffmpeg ?

    I can’t do that with this command : ffmpeg -i 1/25359.mp4 -profile:v main out.mp4.

    That’d return an error :

    ...
    That'd return an error:
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1/25359.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.40.101
     Duration: 00:00:06.08, start: 0.000000, bitrate: 1059 kb/s
       Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), yuv444p, 351x297, 1057 kb/s, 12.50 fps, 12.50 tbr, 12800 tbn, 25 tbc (default)
       Metadata:
         handler_name    : VideoHandler
    No pixel format specified, yuv444p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    x264 [error]: main profile doesn't support 4:4:4
    [libx264 @ 0x8fa9640] Error setting profile main.
    [libx264 @ 0x8fa9640] Possible profiles: baseline main high high10 high422 high444
    Output #0, mp4, to '1/24545.mp4':
     Metadata:
       major_brand     : isom
       minor_version   : 512
       compatible_brands: isomiso2avc1mp41
       encoder         : Lavf56.40.101
       Stream #0:0(und): Video: h264, none, q=2-31, 128 kb/s, 12.50 fps (default)
       Metadata:
         handler_name    : VideoHandler
         encoder         : Lavc56.60.100 libx264
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
  • avcodec/cbs : Factor out common code for writing units

    17 novembre 2019, par Andreas Rheinhardt
    avcodec/cbs : Factor out common code for writing units
    

    All cbs-functions to write units share a common pattern :
    1. They check whether they have a write buffer (that is used to store
    the unit's data until the needed size becomes known after writing the
    unit when a dedicated buffer will be allocated).
    2. They use this buffer for a PutBitContext.
    3. The (codec-specific) writing takes place through the PutBitContext.
    4. The return value is checked. AVERROR(ENOSPC) here always indicates
    that the buffer was too small and leads to a reallocation of said
    buffer.
    5. The final buffer will be allocated and the data copied.

    This commit factors this common code out in a single function in cbs.c.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

    • [DH] libavcodec/cbs.c
    • [DH] libavcodec/cbs.h
    • [DH] libavcodec/cbs_av1.c
    • [DH] libavcodec/cbs_av1.h
    • [DH] libavcodec/cbs_h2645.c
    • [DH] libavcodec/cbs_h2645.h
    • [DH] libavcodec/cbs_internal.h
    • [DH] libavcodec/cbs_jpeg.c
    • [DH] libavcodec/cbs_jpeg.h
    • [DH] libavcodec/cbs_mpeg2.c
    • [DH] libavcodec/cbs_mpeg2.h
    • [DH] libavcodec/cbs_vp9.c
    • [DH] libavcodec/cbs_vp9.h