Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Transcode to virtual device/memory in VLC

    27 septembre 2013, par Atrotygma

    I have a unicast h264 stream from a video transmitter. Now, I would like to view the stream in a web browser using HTML5s tag. For this, I have to transcode it first via VLC to theora/ogg and then streaming it out as a HTTP stream. This works fine for 1 client, but since HTTP streaming isn't multicast, I have the fear that my server will break down really quick because VLC will transcode the input stream for every additional client request.

    For this reason, I'd like to write the transcoded stream in something like a 'virtual device' or memory or any other form of temporary storage (but dear god, NO files, I don't want to destroy my hard disk). Then, I would like to grab the transcoded stream with a secondary VLC instance and stream it via HTTP, so that in the end, I have to transcode it only once for all clients.

    In steps:

    1. [DONE] Grab H.264 unicast stream from transmitter via RTSP
    2. VLC instance 1 transcodes it to theora/ogg and writes it to a temporary memory
    3. VLC instance 2 reads from the memory and streams it via HTTP
    4. [DONE] Browser requests HTTP stream via HTTP live Streaming (html5 video).

    Is this possible in any way?

  • How to use libavformat to concat 2 video files with same codec (re-muxing) ?

    27 septembre 2013, par Tarhan

    I have downloaded videos from CDN in flv format (video H264 and audio AAC) and remux to them to MP4 format. But videos are limited by length. So i've downloaded each video in several parts: started at start point, at point 1, at point 2 (by using seek parameter in url). Each point starts little earlier than ending of previous one.
    Using av_read_frame i scanned all parts and found that intersecting packets not only have same sizes and order but also their dts/pts shifted from each other by constant value. So to concat starting video with video started at point 1 I must do following:
    1. Create output header in output file
    2. Copy all non-intersecting packets from starting video.
    3. Copy all non-intersecting packets from video started at point 1 with changed dts values by shifted it by constant

    How to do all of this using libav (not ffmpeg)? I read How can libavformat be used without using other libav libraries. But in libav it is not working since there not avformat_alloc_output_context2 in libav. Also source avconv.c source is too complex for newbie like me to isolate parts related to stream copy operations.
    Can someone provide me example to:
    - open input_file1 and input_file2 (only needed if procedure differs from standard in generic tutorials)
    - open and write header for output_file with same container format and same video and audio formats
    - write packets from input_file1 to output_file up to packet with for example pos == XXX
    - write packets from input_file2 to output_file changing their dts (or whatever needed) by constant value
    - write correct trailer

    Calculating of time shift in dts i made before.

  • the ffmpeg library cannot open camera on android

    27 septembre 2013, par GilGaMesh

    I have successfully ported ffmpeg 2.0.1 lib to android. The code to open camera is very simple:

    AVFormatContext *fmt_ctx = NULL;
    AVInputFormat *input_fmt;
    
    input_fmt = av_find_input_format("video4linux2"); 
    if (input_fmt == NULL)
        return -1;
    
    char f_name[] = "/dev/video0";
    if ((ret = avformat_open_input(&fmt_ctx, f_name, input_fmt, NULL)) < 0)        // stuck here
    {
        LOG_D("can not open camera, ret = %d", ret);
        return ret;
    }
    

    the strange thing is the ret value is always negative with the following logcat output by av_log:

    09-26 15:27:48.901: E/Codec-FFMpeg(17716): ioctl(VIDIOC_G_PARM): Invalid argument
    

    I change the f_name to /dev/video1 and /dev/video2 (these files indeed exist on my tablet, and my tablet has 2 cameras) and the problems remains. Do i forget anything before calling avformat_open_input()? Thank you!

  • FFMPEG command for audio file streaming

    27 septembre 2013, par Vigo

    I am trying to stream an audio file in mp3 format using the FFMPEG library to a remote computer, located on the same LAN as the sender. The command i used to stream at the sender is given below:

    ffmpeg -re -f mp3 -i sender.mp3 -ar 8000 -f mulaw -f rtp rtp://10.14.35.23:1234
    

    I got the below command on FFMPEG documentation page that generates audio and streams it to port number 1234 on remote computer

    ffmpeg -re -f lavfi -i aevalsrc="sin(400*2*PI*t)" -ar 8000 -f mulaw -f rtp rtp://10.14.35.23:1234
    

    I thought i had made relevant changes to this so that the mp3 streaming command will work, but only to know encounter the error which reads
    "Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height"

    Can anyone tell me what is the wrong parameter here and how to rectify it?

  • Using ffmpeg to generate thumbnails of Videos uploaded in JSP

    27 septembre 2013, par Param Singh

    I need help using ffmpeg in jsp.I'm making a youtube based project.I'm able to upload the videos to the Videos directory in my web folder but now I need to create and store a thumbnail of the uploaded video side by side in the thumbs folder.I can do that with ffmpeg but how? I'm confused that where I'm supposed to store the ffmpeg.exe file in my web directory and use it in UploadVideo.jsp page.Please help me,there's very less content about the same on the internet!