I have had the same problem, trying to cut parts of a RAW disk image.
dd with bs=1 is unusable, therefore I have made a simple C program for the task.
// usage:
// ./cutfile srcfile destfile offset length
// ./cutfile my.image movie.avi 4524 20412452
// compile, presuming it is saved as cutfile.cc:
// gcc cutfile.cc -o cutfile -std=c11 -pedantic -W -Wall -Werror
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
int main(int argc, char *argv[])
{
if(argc != 5) {
printf("error, need 4 arguments!\n");
return 1;
}
const unsigned blocksize = 16*512; // can adjust
unsigned char buffer[blocksize];
FILE *f = fopen(argv[1], "rb");
FILE *fout = fopen(argv[2], "wb");
long offset = atol(argv[3]);
long length = atol(argv[4]);
if(f==NULL || fout==NULL) {
perror("cannot open file");
return 1;
}
fseek(f, offset, SEEK_SET);
while(length > blocksize) {
fread(buffer, 1, blocksize, f);
fwrite(buffer, 1, blocksize, fout);
length -= blocksize;
}
if(length>0) { // copy rest
fread(buffer, 1, length, f);
fwrite(buffer, 1, length, fout);
}
fclose(fout);
fclose(f);
return 0;
}