Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Cut AVI video via FFMPEG results in black screen video, but audio is OK

    25 décembre 2017, par mipi

    I want to trim a AVI video (H264 codec) via ffmpeg. The time interval for the result is available as START_TIME_ORIG and DURATION_ORIG (both in microseconds). To make sure that the resulting video starts with an IDR frame, I determine START_TIME and DURATION via ffprobe by executing

    ffprobe -show_frames -pretty -read_intervals [TIME_FROM%TIME_TO] input.avi
    

    twice to get the IDR frames which are (1st call) closest to START_TIME_ORIG and (2nd call) closest to START_TIME_ORIG+DURATION_ORIG. TIME_FROM and TIME_TO is an interval of 5 seconds plus/minus around (1st call) START_TIME_ORIG and (2nd call) START_TIME_ORIG+DURATION_ORIG. To identify a frame as IDR frame I verify that key_frame=1 and pict_type=I. START_TIME is then set to pkt_dts_time of that frame. In a similar way I calculate DURATION.

    Then ffmpeg is called:

    ffmpeg -ss [START_TIME] -i input.avi -t [DURATION] -codec copy -reset_timestamps 1 -async 1 -map 0 -y output.avi
    

    Unfortunately the resulting video has a black screen only, audio is OK. What is wrong with my approach? Thanks, mipi

  • Adding metadata to the beginning of an mp4

    25 décembre 2017, par kamran taghaddos

    I want to stream mp4 video file.I know that i should place the metadata at beginning, but this is happenning if you have the complete file. Is there any way to create custom metadata and add it to beginning of mp4 video once the first byte of video is taken?

    I want to add these option to metadata(because i have these options from past) :

    Video length, Video frame width, Video frame heught, Video data rate, Video total bitrate, Video frame bit rate,

    Audio bit rate, Audio channels, Audio sample rate

  • Add metadata to beginnig of mp4

    25 décembre 2017, par kamran taghaddos

    I want to stream mp4 video file.I know that i should place the metadata at beginning, but this is happenning if you have the complete file. Is there any way to create custom metadata and add it to beginning of mp4 video once the first byte of video is taken?

    I want to add these option to metadata(because i have these options from past) :

    Video length, Video frame width, Video frame heught, Video data rate, Video total bitrate, Video frame bit rate,

    Audio bit rate, Audio channels, Audio sample rate

  • duration change after transcode ts

    25 décembre 2017, par Feilong Luo

    i have a problem about transcode with ffmpeg

    i want to cover m3u8 to mp4, so i transcode every ts file first, and then concat them to a mp4, but i found that the duration will be bigger than source file.

    source file is : http://oc7iy3eta.bkt.clouddn.com/src_20.ts

    after transcode, test file is: http://oc7iy3eta.bkt.clouddn.com/test_20.ts

    i use the command as bellow to change to 5fps, and 400k bitrate:

    sudo ffmpeg -analyzeduration 2147483647 -probesize 2147483647 -nostdin -y -v warning -i ./src_20.ts -threads 3 -movflags faststart -metadata:s:v rotate=0 -chunk_duration 520000 -video_track_timescale 25000 -pix_fmt yuv420p -copytb 1 -vcodec libx264 -b:v 400000 -minrate 400000 -maxrate 400000 -bufsize 500k -force_key_frames "expr:gte(t,n_forced*2)" -vsync 1 -r 5 -s 544*960 -acodec libfaac -async 1 ./test_20.ts

    i use ffprobe command to see video info:

    source file info:

    Duration: 00:00:01.26, start: 28.346989, bitrate: 921 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 23 kb/s Stream #0:1[0x101]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 544x960, 10.67 tbr, 90k tbn, 180k tbc

    test file:

    Input #0, mpegts, from 'test_20.ts': Duration: 00:00:01.62, start: 1.576778, bitrate: 447 kb/s Program 1 Metadata: service_name : Service01 service_provider: FFmpeg Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 544x960, 5 fps, 5 tbr, 90k tbn, 10 tbc Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp, 5 kb/s

    =======================================================================

    question

    so , we can see that the duration of src file is 1.26s , but after transcode, the test file is 1.62s.

    why? can anybody help

  • How to render YUV420P frames using DirectX ?

    25 décembre 2017, par TTGroup

    I'm using FFMPEG C++ to decode a video file.

    I decoded the frames under YUV420P format in System Memory.

    Next step, I want to render these frames by using DirectX.

    I searched many times, and I know that I have to use the texture2D, but there is not any code sample for my case.

    How to create a texture2D from YUV420 (or RGB instead) from System Memory and render it to the screen.

    And the performance is also important, so I need the best way to do it. Someone can show me the sample code?

    Many Thanks!