Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • How do I cut the last 10 seconds from mpeg using ffmpeg (and applescript etc) [closed]

    10 décembre 2015, par EvGeniy Ilyin

    I have many different mpeg files. In every mpeg file are credits at the end of the video. I need to cut it. How I can do it for bath(list)? for example:

    ffmpeg -i my.mp4 -vcodec copy -acodec copy -ss 00:10:10 my_cute.mp4
    

    but every mpeg file has different duration... Is there a way to specify the indent from the end?

    my answer using applescript organizing logic main parameters: the length of the titles and file folder

    1. to draw up a list of specified path mp4 files
    2. cycles through each file
      1. using ffprobe obtain data in xml with a total length video
      2. parse xml, we obtain the duration of the
      3. using ffmpeg, knowing the total duration of the video and the length of the credits at the end - set the new duration

    -- settings
    set titresDuration to 54.0
    set folderPath to "/Users/-/Downloads/-.XviD.SATRip.Thunder"
    
    set filesList to my filesInFolder(folderPath, true, ".mp4")
    repeat with fileName in filesList
        set videoDuration to my videoDurationOfFile(fileName)
        set fileCutName to do shell script "echo '" & fileName & "' | sed 's/\\.mp4/c\\.mp4/g'"
        if videoDuration > titresDuration then
            set videoDurationWithoutTitres to videoDuration - titresDuration
            set videoDurationWithoutTitres to my numberToString(videoDurationWithoutTitres)
            set ffmpegScript to "/usr/local/bin/ffmpeg -y -i " & quoted form of fileName & " -t " & videoDurationWithoutTitres & " -c copy " & quoted form of fileCutName
            set info to do shell script ffmpegScript
        end if
    end repeat
    log "the end"
    
    
    
    -- helpers methods
    on videoDurationOfFile(fileName)
        set probeScript to "/usr/local/bin/ffprobe -v quiet -print_format xml -show_format " & quoted form of fileName
        set videoTags to do shell script probeScript --"/usr/local/bin/ffprobe -v quiet -print_format xml -show_format " & fileName
        set videoDuration to 0.0
        tell application "System Events"
            set xmlData to make new XML data with properties {name:"xmldata", text:videoTags}
            set xmlFFprobe to XML element "ffprobe" of xmlData
            set xmlFormat to XML element "format" of xmlFFprobe
            set attrs to value of XML attribute "duration" of xmlFormat
            set attrs to do shell script "echo '" & attrs & "' | sed 's/[0]*$//g'"
            set attrs to do shell script "echo '" & attrs & "' | sed 's/\\./,/g'"
            set videoDuration to attrs as real
        end tell
        return videoDuration
    end videoDurationOfFile
    
    on numberToString(this_number)
        set this_number to this_number as string
        set this_number to do shell script "echo '" & this_number & "' | sed 's/,/\\./g'"
        if this_number contains "E+" then
            set x to the offset of "." in this_number
            set y to the offset of "+" in this_number
            set z to the offset of "E" in this_number
            set the decimal_adjust to characters (y - (length of this_number)) thru ¬
                -1 of this_number as string as number
            if x is not 0 then
                set the first_part to characters 1 thru (x - 1) of this_number as string
            else
                set the first_part to ""
            end if
            set the second_part to characters (x + 1) thru (z - 1) of this_number as string
            set the converted_number to the first_part
            repeat with i from 1 to the decimal_adjust
                try
                    set the converted_number to ¬
                        the converted_number & character i of the second_part
                on error
                    set the converted_number to the converted_number & "0"
                end try
            end repeat
            return the converted_number
        else
            return this_number
        end if
    end numberToString
    
    on filesInFolder(folderPath, lookInSubfolders, filter)
        set filesList to {}
        tell application "System Events" to set filesList to POSIX path of (files of folder folderPath whose name contains filter)
        if lookInSubfolders then
            tell application "System Events" to set subfoldersList to POSIX path of (folders of folder folderPath)
            repeat with subfolderPath in subfoldersList
                set subfilesList to my filesInFolder(subfolderPath, true, filter)
                repeat with subfile in subfilesList
                    set end of filesList to subfile
                end repeat
            end repeat
        end if
        return filesList
    end filesInFolder
    
  • Add zooming and panning effect to video through command line

    10 décembre 2015, par Hamza Khan

    I Have created a video from list ofimages using ffmpeg and imagemagick. I want to add the zooming and panning effect using these two tools. Is there any specific command to to this.

  • Cross dissolve with ffmpeg

    10 décembre 2015, par Merc

    I have two videos, one.mp4 and two.mp4. I want to concatenate those videos, so that the first one has a cross-dissolve with the second one when they are linked. Is this doable with ffmpeg? If so, what command shall I use?

  • Overwrite a section of a video with ffmpeg

    10 décembre 2015, par Merc

    I have two videos. The first one first.mp4 is 10 seconds, the second one second.mp4 is 40 seconds. I want to use ffmpeg to overwrite the seconds 5-9 of first.mp4 with a "slice" of the second.mp4 (say the seconds 30 to 35).

    How do I achieve this with ffmpeg?

  • Looking for technical details about X265 encoding and decoding

    10 décembre 2015, par Sitoumbaz

    I'am working on x265, Is there some one who can you share with me how did I encode yuv using x265 codec? I Need to know how do you get pixel encoded from picture_out structure, And can you tell me if this code is good ? Hope get solution from you! I'am using the x265 api documentation but it is less understandable.

    ret = x265_encoder_encode(encoder, pp_nal, &pi_nal, pic_in, pic_out);
    if(ret < 0){
    
        printf("encodePictureIn, Error in x265_encoder_encode %d\n",ret);
        return ret; 
    }
    
    do{
    
        ret = x265_encoder_encode(encoder, pp_nal, &pi_nal, NULL, pic_out);
        printf("...\n");
    
    }while(ret > 0);