Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How to seek mp4 file via Moov information [on hold]

    18 août 2017, par lucemia

    I am trying to write a python package which able to download part of mp4 file by specify time range.

    By this article, it mentioned

    MP4 files consist of chunks of data called atoms. There are atoms to store things like subtitles or chapters, as well as obvious things like the video and audio data. Meta data about where the video and audio atoms are, as well as information about how to play the video like the dimensions and frames per second, is all stored in a special atom called the moov atom. You can think of the moov atom as a kind of table of contents for the MP4 file.

    https://rigor.com/blog/2016/01/optimizing-mp4-video-for-fast-streaming

    I was able to extract the mooc info via some package:

    https://github.com/use-sparingly/pymp4parse/blob/master/pymp4parse.py

    Using chunks of MP4 file for thumbnails

    However, the details about how to compute the mapping between bytes range and time range is missing. Is there any document, or package can help me do so?

  • How to use Visual Studio Compiled libs with MSYS pkg-config

    18 août 2017, par maxhap

    First a bit of background.

    I'm trying to compile ffmpeg on windows with the libass extensions/configuration option.

    Using the visual studio project libass-msvc I built libass using Visual Studio as a static lib.

    I then installed MinGW with MSYS and pkg-config. Following the instructions on the ffmpeg MSVC installation guide I configured the environment to build with the MSVC linker and to build in x64.

    When I try to configure libass for compilation using ./configure --enable-libass --toolchain=msvc I get the following error in the log file:

    File not found ass/ass.h
    pkg-config can not find libass
    

    I have tried the following to fix this.

    1. Create a .pc file for libass and add this to the PKG_CONFIG_PATH environment variable. See file content below. (After doing this pkg-config libass --version prints 0.81, not the right version number but at least something.)

    2. Copy libass .h files into a MinGW/include/ass folder and the .lib file into the MinGW/libs folder.

    3. Add libass include and bin folders to PATH environment variable

    4. Download libass and dependencies source then try to build it using MSYS with MSVC compiler. My aim here was to be able to use "make install" and let MinGW install libass to the correct locations. After hours of trying to fix linker errors, I abandoned this idea as some of the libass dependencies make files only work with the GCC GNU compiler.

    5. Compile libass with GCC GNU using MinGW make/make install then try and install libass using the GNU libs. Again this led to linker errors (I know this was a bad idea but was worth a try).

    6. Tried using extra lib and include build configuration options --extra-cflags="ffmpeg-dir/extra/include" \ --extra-ldflags="ffmped-dir/extra/ffmpeg_build/lib" then adding the libs and .h files into those locations

    .pc file

    libass.pc:
    prefix=/MinGW
    includedir=libass-directory/include
    libdir=libass-director/x64/bin/
    
    Name: libass
    Description: Libass project
    Version: 0.13.7
    

    I am now completely stuck and out of ideas if anyone could give any insight or suggestions into what I'm doing wrong that would be fantastic.

    Thanks in advanced!

  • Force Xvfb to play audio in specific pulseaudio sink

    18 août 2017, par boygiandi

    I'm trying to record audio from Xvfb session. In this Xvfb session, I started firefox, open webpage that contain an element. The audio element play music and loop.

    I create a sink with pulseaudio :

    pactl load-module module-null-sink sink_name=steam

    pacmd set-default-sink steam

    Then I start Xvfb session, start ffmpeg to record video and audio. It works. Now, I want to record another session, so I created new sink, named steam2, set default sink to steam2 like before.

    The problem is, in Xvfb session 1, when the audio stop-and-start (loop), it comes to new sink (steam2), then ffmpeg recorded no audio, steam2 now get mixed from 2 audios.

    Is there any way to force Xvfb session 1 play audio on sink1 ?

  • Record audio from specific Xvfb session on Centos

    18 août 2017, par boygiandi

    I'm trying to record audio from firefox in a Xvfb session. I installed pulseaudio server and I can record audio. But when I have more than 1 Xvfb session, the audio get mixed. How can I start 2 ffmpeg process and record 2 Xvfb sessions separate ?

    The ffmpeg command look like this

    ffmpeg -f pulse -i default -r 30 -framerate 5 -f x11grab -i :xxx -c:v libx264 -x264-params keyint=60 -bufsize 500k -c:a aac -ar 44100 -b:a 128k -f flv ...

    Then I tried to create virtual audio device

    pacmd load-module module-null-sink sink_name=MySink

    pacmd load-module module-loopback sink=MySink

    Set this device as default input/output audio

    pacmd set-default-source "MySink.monitor"

    pacmd set-default-sink "MySink"

    I hope that when I start Xvfb session + firefox, it'll play audio on this device as default and ffmpeg'll also get audio from there. The ffmpeg command now become

    ffmpeg -f pulse -i MySink.monitor -r 30 -framerate 5 -f x11grab -i :xxx -c:v libx264 -x264-params keyint=60 -bufsize 500k -c:a aac -ar 44100 -b:a 128k -f flv ...

    But what I get is noise or ffmpeg error 100 buffers queued in out_0_1, something may be wrong. What did I do wrong ?

    And as I know, firefox 54 doesn't support alsa anymore, so we only can use pulseaudio.

  • MPEG4 quality saved in MATLAB

    17 août 2017, par guyts

    I need to get an mpeg4 file to use in another application, from an original mpeg4 video I loaded into matlab and edited (frame by frame). To do so, I tried using VideoWriter, setting the quality to 100%:

    newVid = VideoWriter(outputfilename, 'MPEG-4');
    newVid.FrameRate = fps;
    newVid.Quality = 100;
    

    However, the result I'm getting is very poor and if the original unedited video size was ~50MB, the one I get post-edit in matlab is around ~20MB, and I don't know how to keep the quality and size as they were. I also tried saving as .avi and converting to mpeg4 with ffmpeg, but it gave even poorer results. Any ideas?