Newest 'ffmpeg' Questions - Stack Overflow

http://stackoverflow.com/questions/tagged/ffmpeg

Les articles publiés sur le site

  • Append text to ffmpeg/avconv command line output to a text file

    29 août 2017, par Ali

    I'm using follow command to add a watermark image and also convert a video file, then for monitoring the convert process, I check the output text file.

    avconv -i input.mp4 -vf "movie=watermark.png [watermark]; [in][watermark] overlay=10:10 [out]" -acodec copy -y output.swf 1> proccess_status.txt 2>&1
    

    Here is a part of proccess_status.txt:

    avconv version 11.9-6:11.9-1~deb8u1, Copyright (c) 2000-2017 the Libav developers
      built on Apr 23 2017 21:47:31 with gcc 4.9.2 (Debian 4.9.2-10)
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/srv/site.com/public/htdocs/videos/8_e7d16e42ec66dc66fa.mp4':
      Metadata:
        major_brand     : mp42
        minor_version   : 0
        compatible_brands: mp41isom
    
    ...
    Stream mapping:
      Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
      Stream #0:1 -> #0:1 (copy)
    Press ctrl-c to stop encoding
    frame=   46 fps=  0 q=0.0 size=       0kB time=1.58 bitrate=   0.2kbits/s    
    frame=   57 fps= 53 q=29.0 size=      27kB time=0.13 bitrate=1633.1kbits/s    
    frame=   69 fps= 44 q=29.0 size=      72kB time=0.53 bitrate=1108.8kbits/s    
    frame=   82 fps= 39 q=29.0 size=     110kB time=0.97 bitrate= 931.8kbits/s    
    ...
    [libx264 @ 0x15475e0] Weighted P-Frames: Y:10.1% UV:8.0%
    [libx264 @ 0x15475e0] ref P L0: 72.3%  9.6% 13.3%  4.7%  0.0%
    [libx264 @ 0x15475e0] ref B L0: 83.1% 14.7%  2.1%
    [libx264 @ 0x15475e0] ref B L1: 93.3%  6.7%
    [libx264 @ 0x15475e0] kb/s:861.12
    

    I want to know how could I add an additional text to the beginning of output text file, or is that possible to append output of ffmpeg command line to an existing file?

  • ffmpeg hangs indefinitely while splitting or segmenting

    29 août 2017, par Jaffer Sathick

    I am splitting and segmenting a video file. Its runs in a separate thread and multiple files will do the same process with different video files. Some times ffmpeg hangs indefinitely and process never closed. Please find my logs below. Is there anything i am doing wrong here ?

    -i archive.mp4 -ss 00:00:00.002 -t 00:14:28.359 0.mp4
    
    -i archive.mp4 -s 320x240 -b 128k -vcodec libx264 -acodec copy -reset_timestamps 1 -map 0 -segment_time 50:00 -f segment part_%02d.mp4 
    

    image 3

    image 2

    Image 1

  • H.264 - Green frames when streaming over TCP using FFmpeg

    29 août 2017, par Naseeb Panghal

    I am using FC23 machine and FFMPEG version is 2.8.10

    Using below command, I can stream flv over tcp successfully and able to receive it successfully at receiver side as well. I play it using vlc player. Both audio and video are played well.

    ./ffmpeg -f x11grab -s 1920x1080 -framerate 15 -i :0.0 -f alsa -ac 2 -i hw:1 -vcodec libx264 -r 30 -pix_fmt yuv420p -tune zerolatency -preset ultrafast -acodec aac -strict -2 -ar 48000 -ab 96k -f flv -metadata streamName=naseeb.sdp tcp://127.0.0.1:6666

    But in actually i need to do this using an application. So i wrote an application in 'C' language. I have done following things in the application.

     1. Open `AVOutputFormat` using below API
        fmt = av_guess_format("flv", NULL , NULL);
     2. Get `AVFormatContext` using below API
        avformat_alloc_output_context2(&oc, fmt, NULL, NULL);
     3. Then added streams(audio and video) using required APIs
     4. Then open codecs using required APIs
     5. Then set the output using below API
        ret = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE);
    

    (A) If I need to write flv into a file on system then I provide filename in step 5 as muxer.flv.

    • result : When I play muxer.flv using VLC player both video and audio are played well

    (B) If I need to stream flv over tcp then I provide filename as tcp://127.0.0.1:6666.

    • result : When it is streamed over network then Green frames are shown for video (yet audio works very well). Is there an extra setting required when I need to stream it over network?

    I have no doubt on Receiver side as it works very well with FFmpeg utility (command mentioned above). Currently I have downloaded ffmpeg 2.8.10 source code and looking into ffmpeg.c file for some extra setting. Till now I have not found anything helpful.

    Please suggest something why Green frames shown when flv is sent on network where it works well when dump on system hard disk.

  • Compile FFmpeg Zeranoe Build with Visual Studio 2013

    29 août 2017, par mFeinstein

    I downloaded the most recent Zeranoe dev build here, included the header files to my code, placed extern "C" around the includes, since this is a C++ project and FFmpeg is a C library, and added the libs to Visual Studio as well, and I get this linker error:

    1>Camera.obj : error LNK2019: unresolved external symbol _av_free referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_freep referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_alloc referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_free referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_register_all referenced in function __catch$??0Camera@MicroDFV_Camera@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0PAX@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_alloc_context3 referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_open2 referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_close referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_init_packet referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_packet_unref referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_find_encoder referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_encode_video2 referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_opt_set referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_image_alloc referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>M:\Desktop\OpenCVTest\Debug\OpenCVTest.exe : fatal error LNK1120: 14 unresolved externals

    Searching here and on Google I found many recommendations, such as to add #pragma comment(lib,...), and that the libs are static, so their order is important, and none of this helps.

    So I scratched my head even more and realized that the Zeranoe build is made with MinGW-w64, so probably it won't link with Visual Studio. I inspected the lib using dumpbin and the symbols on the libs don't have the underscore, so I am pretty sure it won't work.

    The other Zeranoe builds for Windows don't have libs, they are just plain .exe or exe + .dll.

    Will I have to make my own VS2013 build of FFmpeg to link it, or is there some alternative way?

  • MediaController / VideoView can't play mp4 on certain phones

    29 août 2017, par Nicholas Muir

    From within my app I create a video from images that the user has taken using Ffmpeg. I the play this using MediaController and a VideoView. When I run the app using the Genymotion emulator for a Google Nexus 4 the video file plays without issue. When I use the Genymotion emulator for a Samsung Galaxy S4 I get an error from the VideoView on error listener say "Can't play video".

    Thanks for your help.