#11203: ffmpeg hangs at File ended prematurely
--------------------------------+----------------------------------------
             Reporter:  milahu  |                    Owner:  (none)
                 Type:  defect  |                   Status:  new
             Priority:  normal  |                Component:  undetermined
              Version:  6.1.1   |               Resolution:
             Keywords:  hang    |               Blocked By:
             Blocking:          |  Reproduced by developer:  0
Analyzed by developer:  0       |
--------------------------------+----------------------------------------
Comment (by milahu):

 a workaround is to get the actual duration of the audio track
 and limit the transcoding process with `-to $src_adur`

 {{{
 src_path="video.mkv"
 src_aid=0 # audio track id

 # get the actual duration of the audio track
 # https://stackoverflow.com/a/74970367/10440128
 src_adur=$(
   ffmpeg -i "$src_path" -c copy -map 0:a:$src_aid -f null - 2>&1 |
   awk -F= 'BEGIN{RS=" "}/^time=/{t=$2}END{print t}'
 )

 # transcode audio to aac
 # limit transcoding to $src_adur
 # workaround for: ffmpeg hangs at "File ended prematurely"
 af="..."
 args="-af $af -resampler soxr -ar 48k"
 ffmpeg -i "$src_path" -map "0:a:$src_aid" -to $src_adur $args -f wav - |
   qaac -s --no-delay -o dst.m4a -
 }}}
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/11203#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
_______________________________________________
FFmpeg-trac mailing list
FFmpeg-trac@avcodec.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-trac

To unsubscribe, visit link above, or email
ffmpeg-trac-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to