Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (93)

Sur d’autres sites (16719)

  • what is the correct command using gstreamer to convert mp4 to 264 file ?

    25 mars 2020, par hilow

    My english is pool, i am sorry !

    I use ffmpeg and gstreamer convert mp4 file to 264 format, but the output file is different.
    The question is :

    • 1.Why they are different file ?

    • 2.What is the level mean in gst-discoverer-1.0 ?

      Use ffmpeg it is Codec:     video/x-h264, ...... level=(string)1.2.

      Use gstreamer it is Codec:     video/x-h264, ...... level=(string)3.

    • 3.How to use gstreamer to convert the correct 264 file ?

    The original video file is come from https://github.com/notedit/media-server-go-demo/blob/master/video-mixer/public/big_buck_bunny.mp4 .

    command :

    gst-launch-1.0 filesrc location=big_buck_bunny.mp4 ! \
       qtdemux name=demux \
         demux.video_0 ! queue ! \
         decodebin ! \
         videoconvert ! \
         videoscale ! \
         videorate ! \
         video/x-raw,width=320,height=240,framerate=15/1,pixel-aspect-ratio=1/1,level=1.2 ! \
         x264enc bframes=0 byte-stream=true bitrate=9000 ! \
         filesink location=videogst.264

    ffmpeg -i big_buck_bunny.mp4 -f h264 -vcodec libx264 -s 320x240 -bf 0 -r 15 videoffmpeg.264

    output file :

    -rw-r--r-- 1 xxx staff 1.9M 3 25 13:39 videoffmpeg.264
    -rw-r--r-- 1 xxx staff 17M 3 25 13:40 videogst.264

    video codec :

    xxx@xxxs-MacBook-Pro resource %  gst-discoverer-1.0 videoffmpeg.264 -v
    Analyzing file:///Users/xxx/tool/resource/videoffmpeg.264
    Done discovering file:///Users/xxx/tool/resource/videoffmpeg.264

    Topology:
     video: video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.2, codec_data=(buffer)0164000cffe100176764000cacb20283f420000003002000000303c1e2854901000668ebc3cb22c0
       Tags:
         视频编码: H.264 (High Profile)

       Codec:
         video/x-h264, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)1.2, codec_data=(buffer)0164000cffe100176764000cacb20283f420000003002000000303c1e2854901000668ebc3cb22c0
       Additional info:
         None
       Stream ID: 349989c8845fcc23360fb0ab02ea7510051b926669bf8f3862879823fbab6daf
       Width: 320
       Height: 240
       Depth: 24
       Frame rate: 15/1
       Pixel aspect ratio: 1/1
       Interlaced: false
       Bitrate: 0
       Max bitrate: 0

    Properties:
     Duration: 0:01:32.995000000
     Seekable: yes
     Live: no
     Tags:
         视频编码: H.264 (High Profile)


    xxx@xxxs-MacBook-Pro resource % gst-discoverer-1.0 videogst.264 -v
    Analyzing file:///Users/xxx/tool/resource/videogst.264
    Done discovering file:///Users/xxx/tool/resource/videogst.264

    Topology:
     video: video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe1001d6764001eacb20283f602d4180416940000030004000003007a3c58b92001000568ebccb22c
       Tags:
         视频编码: H.264 (High Profile)

       Codec:
         video/x-h264, pixel-aspect-ratio=(fraction)1/1, width=(int)320, height=(int)240, framerate=(fraction)15/1, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, stream-format=(string)avc, alignment=(string)au, profile=(string)high, level=(string)3, codec_data=(buffer)0164001effe1001d6764001eacb20283f602d4180416940000030004000003007a3c58b92001000568ebccb22c
       Additional info:
         None
       Stream ID: fb99f4104b347e5682d52c0bd65bcee91b765e42f89ce2e3553be5d6d743a666
       Width: 320
       Height: 240
       Depth: 24
       Frame rate: 15/1
       Pixel aspect ratio: 1/1
       Interlaced: false
       Bitrate: 0
       Max bitrate: 0

    Properties:
     Duration: 0:01:45.505000000
     Seekable: yes
     Live: no
     Tags:
         视频编码: H.264 (High Profile)
  • Set correct start time of ts-file using ffmpeg

    9 octobre 2020, par Daniel

    I am splitting up a video into multiple 10 second ts-parts (mpeg-ts format) using ffmpeg on windows.

    



    To create the 2nd part (that starts at 10 seconds into the video and ends at 20 seconds into the video) :

    



    ffmpeg -i sample.avi -ss 00:00:10 -to 00:00:20 -vcodec libx264 -acodec aac -vf scale=426:-1 out1.ts


    



    But when i check the file using ffprobe it says :

    



    Duration: 00:00:10.02, start: 1.458667, bitrate: 359 kb/s


    



    So the duration is ok but the start time is incorrect. Is it anyway i can use ffmpeg to correct it to 00:00:20 ?
The best solution would of course to be able to set the correct start time in my first command where i take out the 10 second part but i would also be ok with running a 2nd command to fix the time.

    



    Is this possible ? Cant find any documentation and all examples i found are not for my exact problem and don't seem to work then i play around with them.

    



    Full output from ffprobe :

    



    ffprobe.exe out1.ts
ffprobe version git-2020-02-06-343ccfc Copyright (c) 2007-2020 the FFmpeg developers
  built with gcc 9.2.1 (GCC) 20200122
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 39.100 / 56. 39.100
  libavcodec     58. 68.100 / 58. 68.100
  libavformat    58. 38.100 / 58. 38.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 74.100 /  7. 74.100
  libswscale      5.  6.100 /  5.  6.100
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Input #0, mpegts, from 'out1.ts':
  Duration: 00:00:10.02, start: 1.458667, bitrate: 359 kb/s
  Program 1
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 426x260 [SAR 780:781 DAR 18:11], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 131 kb/s


    


  • How do I make sure FFmpeg generates the correct duration ?

    14 juillet 2019, par Wang

    For example, the following command creates a three-second video.

    ffmpeg -f lavfi -i color=c=red:r=30:d=3:size=800x600 red.nut

    But ffprobe shows the duration is N/A :

    [STREAM]
    index=0
    codec_name=mpeg4
    codec_long_name=MPEG-4 part 2
    profile=Simple Profile
    codec_type=video
    codec_time_base=0/1
    codec_tag_string=FMP4
    codec_tag=0x34504d46
    width=800
    height=600
    coded_width=800
    coded_height=600
    has_b_frames=0
    sample_aspect_ratio=1:1
    display_aspect_ratio=4:3
    pix_fmt=yuv420p
    level=1
    color_range=unknown
    color_space=unknown
    color_transfer=unknown
    color_primaries=unknown
    chroma_location=left
    field_order=unknown
    timecode=N/A
    refs=1
    quarter_sample=false
    divx_packed=false
    id=N/A
    r_frame_rate=30/1
    avg_frame_rate=0/0
    time_base=1/61440
    start_pts=0
    start_time=0.000000
    duration_ts=N/A
    duration=N/A
    bit_rate=N/A
    max_bit_rate=N/A
    bits_per_raw_sample=N/A
    nb_frames=N/A
    nb_read_frames=N/A
    nb_read_packets=N/A
    DISPOSITION:default=0
    DISPOSITION:dub=0
    DISPOSITION:original=0
    DISPOSITION:comment=0
    DISPOSITION:lyrics=0
    DISPOSITION:karaoke=0
    DISPOSITION:forced=0
    DISPOSITION:hearing_impaired=0
    DISPOSITION:visual_impaired=0
    DISPOSITION:clean_effects=0
    DISPOSITION:attached_pic=0
    DISPOSITION:timed_thumbnails=0
    TAG:encoder=Lavc57.107.100 mpeg4
    [/STREAM]

    Is there flag I can set to allow FFmpeg to generate the correct duration_ts and duration ?