Newest 'ffmpeg' Questions - Stack Overflow

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

Les articles publiés sur le site

  • Non-monotonous DTS after 26:30:02.81 recording time

    24 mars, par micha

    I record an hls stream and after 26:30:02.81 there come the message:

    [http @ 0x558330f5ba80] Opening 'http://de-origin-live-be-01.3qsdn.com:8081/3279/996191_PwxkbnqRThCDGXVr/l_94_95438333_16449.ts?nimblesessionid=2106' for reading
    frame=2289669 fps= 24 q=-1.0 size=25056768kB time=26:30:02.81 bitrate=2151.6kbits/s speed=   1x    
    [mpegts @ 0x558330f07280] Invalid timestamps stream=0, pts=10378, dts=8589926250, size=11200
    [mpegts @ 0x558330f07280] Invalid timestamps stream=0, pts=2908, dts=8589929940, size=3407
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:0; previous: 8586744840, current: -3185972; changing to 8586744841. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:1; previous: 4579598864, current: -1698561; changing to 4579598865. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:1; previous: 4579598865, current: -1697537; changing to 4579598866. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:1; previous: 4579598866, current: -1696513; changing to 4579598867. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:0; previous: 8586744841, current: -3182282; changing to 8586744842. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:1; previous: 4579598867, current: -1695489; changing to 4579598868. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:1; previous: 4579598868, current: -1694465; changing to 4579598869. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:1; previous: 4579598869, current: -1693441; changing to 4579598870. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:0; previous: 8586744842, current: -3178502; changing to 8586744843. This may result in incorrect timestamps in the output file.
    [mp4 @ 0x558330f20bc0] Non-monotonous DTS in output stream 0:0; previous: 8586744843, current: -3174722; changing to 8586744844. This may result in incorrect timestamps in the output file.
    

    There is no more video written to the file at this time but ffmpeg is not stopping. If i stop it manual after 30 hours the file is only 26 hours 30 minutes long.

    How to reproduce:

    ffmpeg -progress recorder.progress -reconnect 1 -user_agent 'sdn/1.0' -i http://source/playlist.m3u8 -codec copy -bsf:a aac_adtstoasc record.mp4
    
    ffmpeg version 4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 7 (Ubuntu 7.4.0-1ubuntu1~18.04.1)
      configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libxcb --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-libkvazaar --enable-libaom --extra-libs=-lpthread --enable-postproc --enable-small --enable-version3 --enable-libbluray --enable-demuxer=dash --enable-decoder=hevc --enable-libxml2 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
      libavutil      56. 31.100 / 56. 31.100
      libavcodec     58. 54.100 / 58. 54.100
      libavformat    58. 29.100 / 58. 29.100
      libavdevice    58.  8.100 / 58.  8.100
      libavfilter     7. 57.100 /  7. 57.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  5.100 /  5.  5.100
      libswresample   3.  5.100 /  3.  5.100
      libpostproc    55.  5.100 / 55.  5.100
    
  • Bash script to recursive find and convert movies

    24 mars, par Jacco

    in my large movie collection I would like to search for movies with the primary (first) audio track with DTS coding to be converted to Dolby.

    My problem would be the first track I think. My current bash script will list any movie containing a DTS track, but does not specify which track.

    #!/bin/bash
    # My message to create DTS list
    find /home/Movies -name '*.mkv' | while read f
    do
    if mediainfo "$f" | grep A_DTS; then
    echo $f 
    fi
    done
    

    After that I would like to run this command

    ffmpeg -i $f -map 0:v -map 0:a:0 -map 0:a -map 0:s -c:v copy -c:a copy -c:s copy -c:a:0 ac3 -b:a:0 640k $f
    

    or is there a way to move all the audio tracks down and adding the new AAC track?

    ###Progress

    Thanks to @llogan I have finetuned the bash to find the required files.

    #!/bin/bash
    # My DTS conversion script
    # credits to llogan
    
    find /Mymovies -name '*.mkv' | while read f
    do
     if ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 "$f" | grep dts; then
     echo "$f"
    fi
    done
    

    Now digging into the command I think I may have a working command. Anybody spot a problem?

    ffmpeg -i $f
          -map 0:v -c:v copy
          -map 0:a:0? -c:a:0 ac3
          -map 0:a:0? -c:a:1 copy
          -map 0:a:1? -c:a:2 copy
          -map 0:a:2? -c:a:3 copy
          -map 0:a:3? -c:a:4 copy
          -map 0:a:4? -c:a:5 copy
          -map 0:a:5? -c:a:6 copy
          -map 0:a:6? -c:a:7 copy
          -map 0:a:7? -c:a:8 copy
          -map 0:a:8? -c:a:9 copy
          -map 0:s? -c copy
          -b:a:0 640k
    /tmp/output.mkv
    mv $f /home/DTS_BACKUP/
    mv /tmp/output.mkv $f
    rm /tmp/output.mkv
    

    So the end result would look like:

    #!/bin/bash
    # My DTS conversion script
    # credits to llogan
    find /Mymovies -name '*.mkv' | while read f
    do
     if ffprobe -v error -select_streams a:0 -show_entries stream=codec_name -of csv=p=0 "$f" | grep dts; then
    
    ffmpeg -i $f
              -map 0:v -c:v copy
              -map 0:a:0? -c:a:0 ac3
              -map 0:a:0? -c:a:1 copy
              -map 0:a:1? -c:a:2 copy
              -map 0:a:2? -c:a:3 copy
              -map 0:a:3? -c:a:4 copy
              -map 0:a:4? -c:a:5 copy
              -map 0:a:5? -c:a:6 copy
              -map 0:a:6? -c:a:7 copy
              -map 0:a:7? -c:a:8 copy
              -map 0:a:8? -c:a:9 copy
              -map 0:s? -c copy
              -b:a:0 640k
    /tmp/output.mkv
    mv $f /home/DTS_BACKUP/
    mv /tmp/output.mkv $f
    rm /tmp/output.mkv
    
    fi
    done
    
  • Convert DTS to AC3 but only if there is no AC3 track already present in container

    24 mars, par Domagoj

    I have sound system that does not support DTS only AC3. I'm automating the process using bash that detects when movie was added to folder, downloads subtitles and converts audio track to AC3 using this command (one part of it):

    ffmpeg -i "{{episode}}" -map 0:v -map 0:a:0 -map 0:a -map 0:s -c:v copy -c:a copy -c:s copy -c:a:0 ac3 -b:a:0 640k "{{directory}}"/{{episode_name}}temp2.mkv

    This works without issue and I end up with a .mkv file that contains original DTS audio track and newly created AC3 audio track. The issue is that some files already contain both AC3 and DTS tracks and in those cases I end up with two AC3 tracks and one DTS track. Another issue is that this command is triggered every time there is update to subtitles. So it's possible that the command will execute multiple times in a period of a few days and the container will have X number of the AC3 tracks.

    I need a way to detect if file already contains AC3 track before I initiate command from above, but I'm not sure what the command would be. Any help is appreciated!

  • Why is using ffmpeg to convert MXF files failing ?

    24 mars, par Marinaio

    I have an MXF video

    I googled syntax to convert to mov and ran it in Mobaxterm on Win10.

    "/drives/c/Program Files (x86)/ffmpeg/bin/ffmpeg.exe" -i Clip0001.MXF -c:v libx264 -c:a aac -ab 384k -sn -strict -2 output.mov
    

    I view it in VideoLan and it looks great.

    I load it into Magix Movie Studio 15 and audio is fine, but video is green!

    ffmpeg output.mov....shows me:

    Stream #0:0(eng): Video: h264 (High 4:2:2) (avc1 / 0x31637661), yuv422p, 1920x1080 [SAR 1:1 DAR 16:9], 4530 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    

    Even this does not work:

    ffmpeg.exe -i Clip0001.MXF output.mov
    

    Any suggestions on converting this?

    Edit1:

    Here is what it looks like in the editor: enter image description here

    Edit2: Try this and it works, but quality is terrible.

    ffmpeg.exe" -i Clip0001.MXF -c:v mpeg4 -c:a aac -ab 384k -sn -strict -2 output.mov
    
  • Convert audio files to mp3 using ffmpeg [closed]

    24 mars, par Hrishikesh -Rishi- Choudhari

    I need to convert audio files to mp3 using ffmpeg.

    When I write the command as ffmpeg -i audio.ogg -acodec mp3 newfile.mp3, I get the error:

    FFmpeg version 0.5.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: 
      libavutil     49.15. 0 / 49.15. 0
      libavcodec    52.20. 1 / 52.20. 1
      libavformat   52.31. 0 / 52.31. 0
      libavdevice   52. 1. 0 / 52. 1. 0
      built on Jun 24 2010 14:56:20, gcc: 4.4.1
    Input #0, mp3, from 'ZHRE.mp3':
      Duration: 00:04:12.52, start: 0.000000, bitrate: 208 kb/s
        Stream #0.0: Audio: mp3, 44100 Hz, stereo, s16, 256 kb/s
    Output #0, mp3, to 'audio.mp3':
        Stream #0.0: Audio: 0x0000, 44100 Hz, stereo, s16, 64 kb/s
    Stream mapping:
      Stream #0.0 -> #0.0
    Unsupported codec for output stream #0.0
    

    I also ran this command:

     ffmpeg -formats | grep mp3
    

    and got this in response:

    FFmpeg version 0.5.2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
      configuration: 
      libavutil     49.15. 0 / 49.15. 0
      libavcodec    52.20. 1 / 52.20. 1
      libavformat   52.31. 0 / 52.31. 0
      libavdevice   52. 1. 0 / 52. 1. 0
      built on Jun 24 2010 14:56:20, gcc: 4.4.1
     DE mp3             MPEG audio layer 3
     D A    mp3             MP3 (MPEG audio layer 3)
     D A    mp3adu          ADU (Application Data Unit) MP3 (MPEG audio layer 3)
     D A    mp3on4          MP3onMP4
     text2movsub remove_extra noise mov2textsub mp3decomp mp3comp mjpegadump imxdump h264_mp4toannexb dump_extra
    

    I guess that the mp3 codec isn't installed. Am I on the right track here?