Problem with segmentation

Archived from the Transloadit support forum. Originally posted on January 14, 2014; details may be outdated, see our docs for current behavior. Original thread

So using the segment demo:
https://transloadit.com/docs/conversion-robots#media-playlist

I get this error:
VIDEO_ENCODE_VALIDATION: undefined
Segmentation is only supported from stack v2.0.0 and up

So I tried adding “ffmpeg_stack”: “v2.0.0” to the template:
“segments”: { “robot”: “/video/encode”, “preset”: “iphone-high”, “ffmpeg_stack”: “v2.0.0”, “segment”: true, “segment_duration”: 10 },

And I get this error:
INTERNAL_COMMAND_ERROR: One of our commands reported an error.
FfmpegCommand failed with exit code: 1

This is the output of the assembly:
ffmpeg version N-54234-gef90639 Copyright (c) 2000-2013 the FFmpeg developers built on Jun 28 2013 05:26:06 with gcc 4.6 (Debian 4.6.3-1)
configuration: --prefix=/root/ffmpeg-static/64bit --extra-cflags=‘-I/root/ffmpeg-static/64bit/include -static’ --extra-ldflags=‘-L/root/ffmpeg-static/64bit/lib -static’ --extra-libs=‘-lxml2 -lexpat -lfreetype’ --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
libavutil 52. 37.101 / 52. 37.101
libavcodec 55. 17.100 / 55. 17.100
libavformat 55. 10.100 / 55. 10.100
libavdevice 55. 2.100 / 55. 2.100
libavfilter 3. 77.101 / 3. 77.101
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from ‘/srv/shared/tmp/scratch/REDACTED’:
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 1970-01-01 00:00:00
encoder : Lavf52.99.1
Duration: 00:00:33.07, start: 0.000000, bitrate: 1162 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1024x768 [SAR 1:1 DAR 4:3], 1048 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 126 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
-async is forwarded to lavfi similarly to -af aresample=async=2:min_hard_comp=0.100000:first_pts=0. [libx264 @ 0x2b0a600] using SAR=640/639 [libx264 @ 0x2b0a600] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 [libx264 @ 0x2b0a600] profile High, level 3.0 [mp4 @ 0x2abb760] Codec for stream 0 does not use global headers but container format requires global headers [mp4 @ 0x2abb760] Codec for stream 1 does not use global headers but container format requires global headers Output #0, mp4, to ‘/srv/shared/tmp/scratch/REDACTED-%05d.ts’:
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.10.100
Stream #0:0(und): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 480x320 [SAR 640:639 DAR 320:213], q=10-51, 700 kb/s, 12800 tbn, 25 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 128 kb/s
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Stream mapping:
Stream #0:0 → #0:0 (h264 → libx264)
Stream #0:1 → #0:1 (aac → libvo_aacenc)
Press [q] to stop, [?] for help
[swscaler @ 0x2a9f700] Warning: data is not aligned! This can lead to a speedloss [mp4 @ 0x2abb760] Malformed AAC bitstream detected: use audio bitstream filter ‘aac_adtstoasc’ to fix it (‘-bsf:a aac_adtstoasc’ option with ffmpeg) av_interleaved_write_frame(): Operation not permitted

How can I get this working?

Hi Bill,

It mentions in the error that there was a malformed AAC bitstream detected. It suggest using -bsf:a aac_adtstoasc to fix it.

Could you try adding that to the ffmpeg parameters?

ffmpeg: {
  "bsf:a": "aac_adtstoasc"
}

If you keep running into problems it helps to supply the assembly id, then we can also look at the media you were trying to encode, etc.

Hope this helps.
Kind regards,
Kevin

Tried adding this and got the same error with two different files. Here are the assembly ids:

REDACTED

REDACTED

Any word on this?

Hi Bill,

Sorry about the delayed response, and thanks for trying the bsf:a aac_adtstoasc suggestion. I’m thinking dispite all the warnings ffmpeg throws at us for these assemblies, the real error is av_interleaved_write_frame(): Operation not permitted. It was quite easy to miss.

I’m trying to figure out what can cause it. People suggest ‘not enough diskspace’ however I have confirmed that your failing assemblies ran on different encoding machines, and they all have hundreds of gigabytes of free space left.

I will keep digging for a solution; in the meantime, do the input files have something in common in the way they were created as far as you can tell? I’m asking because other customers don’t have this issue, and it could lead us to a cause sooner if we know.

Kind regards,
Kevin

Hi Bill,

I’m beginning to think our current v2.0.0 stack has troubles with the aac in your media. So today I’ve been working on a newer stack with a better aac codec in it, so we can test this.

Obviously it takes some time to build, test, and put this in production.
I hope to have something for you early next week, would that be okay?

Kind regards,
Kevin

Yeah, sure. As for the input files, one is a video from my iPhone, and the other is an mp4 downloaded from the web. Its pretty important that iphone/ipad .mov files work cause I imagine thats how many users will upload vids.

Thank you.

Thanks for the extra info, that makes the problem all the more weird.

Stay tuned!

Best,
Kevin

Hey Bill,

I’ve just launched our new v2.1.0 stack which features libfdk_aac. It supports higher quality aac encoding and 5.1 surround sound among things.

Please feel free to give her a spin. Our v2.1.0 presets already default to using the new aac codec.

Kind regards,
Kevin