Videoclip creation fails if mp3 has chapters (duration is incorrect)
If an mp3 file has chapters, they are not correctly translated when the file is trimmed.
Therefore the generated videoclip has chapter marks that are beyond its duration.
Steps to reproduce
- Create a new episode with an mp3 that has chapters (eg. 12922589-live-at-the-podcast-show-youtube-rss-plans-and-the-edison-podcast-ranker.mp3)
- Add an SRT transcript
- Create a new videoclip (eg. from 1462s to 1630s)
- Open the videoclip in VLC: it appears to be 15mn37s long (wheareas it is only 168s)
Expected behavior
Videoclip should be 168s
Actual behavior
Videoclip is 15mn34s long
Relevant logs and/or screenshots
Videoclip length is incorrect:
Original mp3 has chapters:
$ ffprobe -i 12922589-live-at-the-podcast-show-youtube-rss-plans-and-the-edison-podcast-ranker.mp3
ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, mp3, from '/home/benjamin/Music/podland/20230526/12922589-live-at-the-podcast-show-youtube-rss-plans-and-the-edison-podcast-ranker.mp3':
Metadata:
title : Live at The Podcast Show: YouTube RSS plans and the Edison Podcast Ranker
encoded_by : auphonic.com
genre : Podcast
artist : James Cridland and Sam Sethi
album : Podnews Weekly Review
date : 2023
Duration: 00:40:00.24, start: 0.025056, bitrate: 96 kb/s
Chapters:
Chapter #0:0: start 68.094000, end 579.138000
Metadata:
title : YouTube's RSS plans
Chapter #0:1: start 579.138000, end 867.988000
Metadata:
title : Edison Podcast Ranker UK
Chapter #0:2: start 867.988000, end 1062.004000
Metadata:
title : Good financial news
Chapter #0:3: start 1062.004000, end 1314.494000
Metadata:
title : Twitter and podcasting
Chapter #0:4: start 1314.494000, end 1453.979000
Metadata:
title : Spotify news
Chapter #0:5: start 1453.979000, end 1683.875000
Metadata:
title : The Tech Stuff
Chapter #0:6: start 1683.875000, end 1820.200000
Metadata:
title : Events
Chapter #0:7: start 1820.200000, end 2097.517000
Metadata:
title : Boostagram Corner
Chapter #0:8: start 2097.517000, end 2400.170000
Metadata:
title : Sam and James's Week
Stream #0:0: Audio: mp3, 44100 Hz, mono, fltp, 96 kb/s
Metadata:
encoder : LAME3.100
Side data:
replaygain: track gain - -3.300000, track peak - unknown, album gain - unknown, album peak - unknown,
Stream #0:1: Video: mjpeg (Baseline), yuvj444p(pc, bt470bg/unknown/unknown), 600x600 [SAR 1:1 DAR 1:1], 90k tbr, 90k tbn (attached pic)
Metadata:
title : Episode Artwork
comment : Cover (front)
Videoclip has incorrect chapters:
$ ffprobe -i clip-podnews-1462-1631.mp4
ffprobe version 5.1.2-3ubuntu1 Copyright (c) 2007-2022 the FFmpeg developers
built with gcc 12 (Ubuntu 12.2.0-14ubuntu2)
configuration: --prefix=/usr --extra-version=3ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librist --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --disable-sndio --enable-libjxl --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-libplacebo --enable-librav1e --enable-shared
libavutil 57. 28.100 / 57. 28.100
libavcodec 59. 37.100 / 59. 37.100
libavformat 59. 27.100 / 59. 27.100
libavdevice 59. 7.100 / 59. 7.100
libavfilter 8. 44.100 / 8. 44.100
libswscale 6. 7.100 / 6. 7.100
libswresample 4. 7.100 / 4. 7.100
libpostproc 56. 6.100 / 56. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'clip-london-1462.42-1631.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
title : Live at The Podcast Show: YouTube RSS plans and the Edison Podcast Ranker
artist : James Cridland and Sam Sethi
album : Podnews Weekly Review
date : 2023
encoder : Lavf58.45.100
genre : Podcast
Duration: 00:15:37.70, start: 0.000000, bitrate: 40 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 221.405000
Metadata:
title : The Tech Stuff
Chapter #0:1: start 221.405000, end 357.730000
Metadata:
title : Events
Chapter #0:2: start 357.730000, end 635.047000
Metadata:
title : Boostagram Corner
Chapter #0:3: start 635.047000, end 937.700000
Metadata:
title : Sam and James's Week
Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1200x1200 [SAR 1:1 DAR 1:1], 147 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 69 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]
Stream #0:2[0x3](eng): Data: bin_data (text / 0x74786574)
Metadata:
handler_name : SubtitleHandler
Unsupported codec with id 98314 for input stream 2
Context
- Castopod: 1.3.5-dev
- OS: Debian GNU/Linux 11 (bullseye)
- Browser: Firefox
- Web server: PHP Spark
Possible fixes
Remove all chapter metadata from mp3 after trimming?