Recherche avancée

Médias (91)

Sur d’autres sites (335)

  • FFMPEG : FATAL error, file duration too long for timebase ?

    26 février, par clx

    I want to add a subtitle track on a ProRes files with ffmpeg command on Windows :

    


    ffmpeg.exe  -i "X:\Test\Tokyo01.mov" -i "X:\Test\SubtitleEN.srt" -f mov -c:v copy -c:a copy -c:s mov_text -map 0:v -map 0:a -map "1:0" "-metadata:s:s:0" "language=EN" "-metadata:s:s:0" "handler_name=English"  "-metadata:s:s:0" "title=English" -y "X:\Test\Tokyo01_WithSub.mov" 


    


    I have a fatal error at the end :

    


    ...
FATAL error, file duration too long for timebase, this file will not be1737.7kbits/s speed=0.979x
playable with QuickTime. Choose a different timebase with -video_track_timescale or a different container format
...


    


    Source file looks good with FFProbe :

    


    
[STREAM]
index=0
codec_name=prores
codec_long_name=Apple ProRes (iCodec Pro)
profile=HQ
codec_type=video
codec_time_base=15139/363340
codec_tag_string=apch
codec_tag=0x68637061
width=3996
height=2160
coded_width=3996
coded_height=2160
closed_captions=0
has_b_frames=0
sample_aspect_ratio=N/A
display_aspect_ratio=N/A
pix_fmt=yuv422p10le
level=-99
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=unspecified
field_order=unknown
timecode=N/A
refs=1
id=N/A
r_frame_rate=24/1
avg_frame_rate=363340/15139
time_base=1/90000
start_pts=0
start_time=0.000000
duration_ts=340627500
duration=3784.750000
bit_rate=656235296
max_bit_rate=N/A
bits_per_raw_sample=10
nb_frames=90835


    


    The complete FFmpeg return console :

    


    ffmpeg version 2023-09-04-git-f8503b4c33-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 19.100 / 58. 19.100
  libavcodec     60. 25.100 / 60. 25.100
  libavformat    60. 11.100 / 60. 11.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'X:\Test\Tokyo01.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.76.100
  Duration: 01:03:04.79, start: 0.000000, bitrate: 663143 kb/s
  Stream #0:0[0x1]: Video: prores (HQ) (apch / 0x68637061), yuv422p10le, 3996x2160, 656235 kb/s, 24 fps, 24 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
  Stream #0:1[0x2]: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 5.1, s32 (24 bit), 6912 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[srt @ 000001bc0ec608c0] UTF16 is automatically converted to UTF8, do not specify a character encoding
Input #1, srt, from 'X:\Test\SubtitleEN.srt':
  Duration: N/A, bitrate: N/A
  Stream #1:0: Subtitle: subrip
Output #0, mov, to 'X:\Test\Tokyo01_WithSub.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf60.11.100
  Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le, 3996x2160, q=2-31, 656235 kb/s, 24 fps, 24 tbr, 90k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : FFMP
  Stream #0:1: Audio: pcm_s24le (in24 / 0x34326E69), 48000 Hz, 5.1, s32 (24 bit), 6912 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2(EN): Subtitle: mov_text (text / 0x74786574)
    Metadata:
      handler_name    : English
      title           : English
      encoder         : Lavc60.25.100 mov_text
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #1:0 -> #0:2 (subrip (srt) -> mov_text (native))
Press [q] to stop, [?] for help
FATAL error, file duration too long for timebase, this file will not be1737.7kbits/s speed=0.979x
playable with QuickTime. Choose a different timebase with -video_track_timescale or a different container format
[out#0/mov @ 000001bc0e847340] video:303184287kB audio:3193418kB subtitle:9kB other streams:0kB global headers:0kB muxing overhead: 0.000585%
frame=90834 fps= 23 q=-1.0 Lsize=306379507kB time=01:03:04.77 bitrate=663147.3kbits/s speed=0.979x



    


    I don't find documentation for mentionned command "-video_track_timescale" to change timescale (here 1/90000 ).
I don't understand the problem ??

    


  • How to merge special ts files to mp4 ? [closed]

    21 février, par mikezang

    I have some ts files and I want to merge them to mp4, I used command as below, some of ts can be merged without any problems.

    


    ffmpeg -i 'concat:01.ts|02.ts|03.ts|' -c copy -bsf:a aac_adtstoasc 01.mp4


    


    Then I found for some ts files, I got error as below when I used the same command above, what can I do to merge these ts files ?

    


    ffmpeg version 2023-11-13-git-67a2571a55-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 32.100 / 58. 32.100
  libavcodec     60. 33.100 / 60. 33.100
  libavformat    60. 17.100 / 60. 17.100
  libavdevice    60.  4.100 / 60.  4.100
  libavfilter     9. 13.100 /  9. 13.100
  libswscale      7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc    57.  4.100 / 57.  4.100
[png @ 0000028b191c1cc0] inflate returned error -3
Input #0, png_pipe, from 'concat:001.ts|002.ts|003.ts':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: png, pal8(pc, gbr/unknown/unknown), 800x800, 25 fps, 25 tbr, 25 tbn
Output #0, mp4, to '01.mp4':
  Metadata:
    encoder         : Lavf60.17.100
  Stream #0:0: Video: png (mp4v / 0x7634706D), pal8(pc, gbr/unknown/unknown), 800x800, q=2-31, 25 fps, 25 tbr, 12800 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
[out#0/mp4 @ 0000028b19260cc0] video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[out#0/mp4 @ 0000028b19260cc0] Output file is empty, nothing was encoded


    


    The successful ts file by ffprobe :

    


    Input #0, mpegts, from '001.ts':
  Duration: 00:00:12.04, start: 0.038000, bitrate: 942 kb/s
  Program 1
  Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn
  Stream #0:1[0x101]: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 97 kb/s


    


    The failed ts file by ffprobe :

    


    [png @ 000001e9016fe940] inflate returned error -3
Input #0, png_pipe, from '001.ts':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: png, pal8(pc, gbr/unknown/unknown), 800x800, 25 fps, 25 tbr, 25 tbn


    


  • Issue with ffprobe execution within Docker Environment

    7 mars, par Khải Hồ Quang

    Here is my Dockerfile :

    


    FROM node:18-slim as builder

WORKDIR /usr/src/ai_api_builder/

COPY package*.json tsconfig.json /usr/src/ai_api_builder/

RUN apt-get update && \
    apt-get install mariadb-client -y && \
    npm install && npm cache clean --force

RUN apt install ffmpeg -y && \
    ffmpeg -version && \
    ffprobe -version
COPY ${REPO_DIR}/ ./

RUN npm run build && mv audio_store node_modules dist/

FROM node:18-slim

# Create and cd into app directory
WORKDIR /usr/src/dwt_api_app/dist

# Copy the artifact to the new image
COPY --from=builder /usr/src/dwt_api_builder/dist ./

EXPOSE 3001

ENTRYPOINT ["node", "app.js"]


    


    When I build Dockerfile, the step check ffmpeg and ffprobe version worked :

    


    ffmpeg version 5.1.4-0+deb12u1 Copyright (c) 2000-2023 the FFmpeg developers
built with gcc 12 (Debian 12.2.0-14)
...
ffprobe version 5.1.4-0+deb12u1 Copyright (c) 2007-2023 the FFmpeg developers


    


    But when I run container, my TypeScript code not work (the metadata return undefined) :

    


    import { ffprobe } from "fluent-ffmpeg";
ffprobe(latestFilePath, async function(err: any, metadata: any) {
    console.log("metadata", metadata);
})


    


    When I exec to container and check ffmpeg -version and ffprobe -version, I got : bash: ffmpeg: command not found. And when I check in bin folder, also couldn't find ffmpeg.
    
I tried it locally (Centos7), not in container, it worked (metadata return an object), and here is ffprobe version

    


    ffprobe version 6.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2007-2023 the FFmpeg developers <b>&#xA;&#xA;</b>

    &#xA;

    What step did I do wrong when running the container or is there any difference between debian (in container) and centos 7 (local) that I need to pay attention to ? Thanks

    &#xA;