Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Use ffmpeg to cut out the first chapter

    7 janvier 2017, par UnR34L

    I'm trying to remove the first chapter of a TV show rip. The idea is to have something similar to netflix, where the first episode will show the intro then the consecutive episodes don't.

    I've been getting the chapter time with ffprobe then doing it manually with this

    for %%A IN (*.mp4) DO ffmpeg -ss  -i "%%A" -vcodec copy -acodec copy "tmp.mp4" && DEL "%%A" && RENAME "tmp.mp4" "%%A"
    

    How do I pass the first chapter time code value so ffmepg knows where to seek to?

    Also hoping to use the same the same value to offset the subtitles so they align after the cut.

    Note: The machine I've doing the cutting on is windows but I can use my FreeBSD server if that's easier.

  • ffmpeg isn't accepting "%d" format ?

    7 janvier 2017, par Tim Wescott

    So, I have a directory full of files named motor_animate_000.gif, motor_animate_001.gif, etc.

    I run:

    ffmpeg -r 30 -i motor_animate_%03d.gif -r 30 motor.mpg
    

    I expect to get a file called motor.mpg, but instead I get the usual bunch of printout, ending with:

    motor_animate_%03d.gif: No such file or directory
    

    What? This worked in Ubuntu 14.04, but doesn't work now. What I'm doing appears to be consistent with the ffmpeg man page. I'm now officially clueless. Thanks in advance.

    Here's what I get when I try the alternate suggested below:

    tim@Servo:~/Documents/Movies/dcmotor/animation$ ffmpeg -f image2 -framerate 30 -i motor_animate_%03d.gif motor.mpg
    ffmpeg version 2.8.10-0ubuntu0.16.04.1 Copyright (c) 2000-2016 the FFmpeg developers
      built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
      configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
      libavutil      54. 31.100 / 54. 31.100
      libavcodec     56. 60.100 / 56. 60.100
      libavformat    56. 40.101 / 56. 40.101
      libavdevice    56.  4.100 / 56.  4.100
      libavfilter     5. 40.101 /  5. 40.101
      libavresample   2.  1.  0 /  2.  1.  0
      libswscale      3.  1.101 /  3.  1.101
      libswresample   1.  2.101 /  1.  2.101
      libpostproc    53.  3.100 / 53.  3.100
    [image2 @ 0x20bd420] Could not find codec parameters for stream 0 (Video: none, none): unknown codec
    Consider increasing the value for the 'analyzeduration' and 'probesize' options
    motor_animate_%03d.gif: could not find codec parameters
    Input #0, image2, from 'motor_animate_%03d.gif':
      Duration: 00:00:04.03, start: 0.000000, bitrate: N/A
        Stream #0:0: Video: none, none, 30 fps, 30 tbr, 30 tbn, 30 tbc
    No decoder for stream #0:0, filtering impossible
    Error opening filters!
    
  • convert video into ppm files

    6 janvier 2017, par tracer_rock

    I have found a tutorial to convert a video into ppm. http://webcache.googleusercontent.com/search?q=cache:http://dranger.com/ffmpeg/tutorial01.html&gws_rd=cr&ei=BU9tWNyFNsvCjwTXqbuwDg

    However, I don't get why width*3 here.

    void SaveFrame(AVFrame *pFrame, int width, int height, int iFrame) {
      FILE *pFile;
      char szFilename[32];
      int  y;
    
      // Open file
      sprintf(szFilename, "frame%d.ppm", iFrame);
      pFile=fopen(szFilename, "wb");
      if(pFile==NULL)
        return;
    
      // Write header
      fprintf(pFile, "P6\n%d %d\n255\n", width, height);
    
      // Write pixel data
      for(y=0; ydata[0]+y*pFrame->linesize[0], 1, width*3, pFile);
      }
    
      // Close file
      fclose(pFile);
    }
    
  • codecs.ascii_decode(input, self.errors)[0] UnicodeDecodeError : 'ascii' codec can't decode byte 0xc2 in position 318 : ordinal not in range(128)

    6 janvier 2017, par dtidy

    I am trying to open and readlines a .txt file that contains a large amount of text. Below is my code, i dont know how to solve this problem. Any help would be very appreciated.

    file = input("Please enter a .txt file: ")
    myfile = open(file)
    x = myfile.readlines()
    print (x)
    

    when i enter the .txt file this is the full error message is displayed below:

    line 10, in  x = myfile.readlines()
    line 26, in decode return codecs.ascii_decode(input, self.errors)[0]
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 318: ordinal not in range(128)
    
  • why ffmpeg trimming videos while converting to m3u8 ?

    6 janvier 2017, par Puneet Singh

    I am using ffmpeg version 3.2.2, and converting mp4 and mov files to m3u8 format by below command.

    ffmpeg -i test.mov output.m3u8
    

    The length of test.mov is around 3 min, but it convert it to last 24-25 seconds of only, when I play that m3u8 in player. I even merge all the segments of m3u8 to confirm the length of video, by command

    ffmpeg -i output.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4 
    

    the output.mp4 is also 24-25 sec, the last 24 seconds of test.mov.

    I don't know what is wrong, it is working with small length input files like 10 seconds file.